perfect square using js code example Example: javascript perfect square var isSquare = function (n) { return n > 0 && Math.sqrt(n) % 1 === 0; };