0

How to check if a variable is an integer in JavaScript?

JavaScript
var data = 'test';

if (data === parseInt(data, 10))
    console.log("data is integer")
else
    console.log("data is not an integer")
RUN
add comment
Suggest a different solution or add another example