Blog Featured Js

Quite often it is necessary to check if the variable’s value in JavaScript is integer. Here is a quick code snippet of how you could do that.

if ( my_variable !== parseInt(my_variable, 10) ) { alert("my_variable is an integer"); }

Anton Zaroutski

WordPress Specialist, Front End and PHP Developer, @xeiter

Leave a Reply

Your email address will not be published. Required fields are marked *