1

I stumbled upon this for the first time, what does the ~~n mean in JavaScript?

var isSquare = function(n) {
   n = Math.sqrt(n);
   return n == ~~n;
}

I know that the code checks if n is a "perfect" square.

Bryant Makes Programs
  • 1,493
  • 2
  • 17
  • 39
userden
  • 1,615
  • 6
  • 26
  • 50
  • See this https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators (bitwise not) – sodawillow Dec 29 '16 at 19:31

0 Answers0