JSFiddle - React, Tailwind, and code Playground

JavaScript

var values = [40,"40","40.","40.1",40.1,"40-d","40-12","40 years"];

function isInt(value) {
    return !isNaN(value) && value % 1 === 0;
};
for(var i=0; i<values.length; i++) {
    var value = values[i];
    document.write(value+ ' : ' + isInt(value) + '<br>');
}