Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

typescript check if string is number

let numberToCheck: string = "40";

if(!isNaN(Number(numberToCheck))) {
	console.log("string is a number")
}
else {
	console.log("string is NOT a number")
}
 
PREVIOUS NEXT
Tagged: #typescript #check #string #number
ADD COMMENT
Topic
Name
2+1 =