let string = "13th"
string = Number(string)
I expect it to return 13 instead I get NaN please how do I go about it
let string = "13th"
string = Number(string)
I expect it to return 13 instead I get NaN please how do I go about it
 
    
    Try with parseInt()
If
parseIntencounters a character that is not a numeral in the specified radix, it ignores it and all succeeding characters and returns the integer value parsed up to that point.parseInttruncates numbers to integer values. Leading and trailing spaces are allowed.
let string = "13th";
string = parseInt(string);
console.log(string);