I have created a function that checks if the argument that is passed is an integer or a float. But for some reason it keeps on returning true when I pass in a string. I don't understand how this happening??
If anyone can help me figure this out I would really appreciate it
function isNumeric(val){
var patt = new RegExp('^[0-9]+$');
return (patt.test(val) || Math.floor(val) !== val);
}
console.log(isNumeric("Hello")); //Returns true??