Answers for "check if string contains anything other than numbers"

0

check if string contains anything other than numbers

String.prototype.isNumber = function(){return /^\d+$/.test(this);}
console.log("123123".isNumber()); // outputs true
console.log("+12".isNumber()); // outputs false
Posted by: Guest on March-11-2021

Code answers related to "check if string contains anything other than numbers"

Browse Popular Code Answers by Language