I was playing around with some Javascript snippets today and noticed that this code would actually run:
{{for(var i = 0; i < 3; i++) {{{{
alert(i);
}}}}}}
You can try it out for yourself on jsFiddle.
Why does this run without any syntax errors? What do the repeated brackets mean? Does Javascript just ignore repeated curly braces?
It creates a new block, which is effectively useless1 because JavaScript doesn't have block scope2.
1 This is a beautiful oxymoron.
2 Yet.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With