0
> ~3
-4
> ~4
-5
> ~0
-1
> ~-1
0
> ~0
-1
>~'str'
-1

So for numbers, it's basically +1 and multiply (-1), for strings, it just returns (-1), what does it really doing here? Is there a name for '~'?

Searene
  • 25,920
  • 39
  • 129
  • 186
  • 2
    Probably [bitwise not](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Bitwise_NOT), given that's what it is for javascript – NightShadeQueen Jul 19 '15 at 02:19
  • 1
    It's what it says it is in the documentation. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Bitwise_operators. Its name is "tilde". –  Jul 19 '15 at 02:35
  • 1
    I downvoted because you are expected to perform _some_ research before asking a question. In this case you could simply have looked up JavaScript operators. It would have taken you all of twenty seconds. – Lightness Races in Orbit Jul 19 '15 at 02:36

0 Answers0