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
I would definitely go for:
var isSquare = function (n) { return Math.sqrt(n) % 1 === 0; };
PS: 0 is a square number for those who wonder
0
Demo