I created a function that will test to see if a given parameter is a square number.
Read about square numbers here: https://en.wikipedia.org/?title=Square_number
Try this:
var isSquare = function (n) { return n > 0 && Math.sqrt(n) % 1 === 0; };
sqrt
integer
Demo