Turns a string into a number if it's a valid number, returns undefined otherwise;
string
number
undefined
stringToNumberOrUndefined("618") === 618stringToNumberOrUndefined("3.14") === 3.14stringToNumberOrUndefined("SHREK") === undefined Copy
stringToNumberOrUndefined("618") === 618stringToNumberOrUndefined("3.14") === 3.14stringToNumberOrUndefined("SHREK") === undefined
Generated using TypeDoc
Turns a
string
into anumber
if it's a valid number, returnsundefined
otherwise;