I\'m doing some trouble-shooting and want to add a check that a parameter to a function is a number. How do I do this?
Something like this...
function fn
=== means strictly equals to and == checks if values are equal. that means "2"==2 is true but "2"===2 is false.
using regular expression
var intRegex = /^\d+$/; if(intRegex.test(num1)) { //num1 is a valid integer }
example of == vs. ===