-
-
Save makeusabrew/827477 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Determine whether the supplied value's datatype is Number | |
* @param {Mixed} value Could be a true number: 123, 12.00, or eg: "123", "12.00" | |
* @return {Boolean} Whether value's type is Number, eg: "123" would be false whereas 123 would be true. | |
*/ | |
function isNumber(data) | |
{ | |
var num = parseFloat(data); | |
return ! isNaN(parseFloat(data)) && num.toString() === data.toString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment