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
If the number is a square number, it returns true and otherwise false. Negative numbers also return false.
Examples:
isSquare(-12) // => false
isSquare( 5) // => false
isSquare( 9) // => true
isSquare(25) // => true
isSquare(27) // => false
Right now, I am using this method: http://jsfiddle.net/marcusdei/ujtc82dq/5/
But, is there a shorter more cleaner way to get the job done?
Try this:
sqrt
is complete number i.e.integer
Demo