function isFloat(n) {
  return n === +n && n !== (n|0);
}

function isInteger(n) {
  return n === +n && n === (n|0);
}

document.writeln("isFloat(2.5): "+isFloat(2.5)+"<br/>");
document.writeln("isInteger(8): "+isInteger(8)+"<br/>");
document.writeln("isFloat('hello'): "+isFloat("hello")+"<br/>");
document.writeln("isInteger('hello'): "+isInteger("hello")+"<br/>");
document.writeln("isFloat(5): "+isFloat(5)+"<br/>");
document.writeln("isInteger(3.5): "+isInteger(3.5)+"<br/>");

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.