2

if I run the following code:

~ function() {
alert('I am new here');
}();

the page alerts: 'I am new here'. however if I try to run:

function() {
alert('I am new here');
}();

I get syntax error.

I can't find any explanation of tilde (~) that would explain this situation.

  • 2
    In this context, `~` is being used for the same thing `!` is in the linked [*JavaScript plus sign in front of function name*](http://stackoverflow.com/questions/13341698/javascript-plus-sign-in-front-of-function-name) question; its answers apply. – T.J. Crowder Mar 06 '17 at 19:42
  • Thank you!, exactly what I was looking for. How can I +1 your comment ? – user3784950 Mar 06 '17 at 19:54
  • You can't yet, but no worries! You will at some point: http://stackoverflow.com/help/privileges – T.J. Crowder Mar 06 '17 at 20:10

0 Answers0