function checkFloatOrInteger(n) {
if (typeof n == 'number' && !isNaN(n)) {
if (Number.isInteger(n)) {
console.log(`${n} is integer`);
}
else {
console.log(`${n} is float`);
}
} else {
console.log(`${n} is not a number`);
}
}
checkFloatOrInteger(3456);
checkFloatOrInteger(3.14);
checkFloatOrInteger(-2.895);
checkFloatOrInteger(NaN);
checkFloatOrInteger('javascript');
/*
run:
"3456 is integer"
"3.14 is float"
"-2.895 is float"
"NaN is not a number"
"javascript is not a number"
*/