Christian Heilmann

Stupid Tricks with JavaScript

Friday, June 9th, 2006 at 11:23 am

Dude, check this out

This does not throw a syntax error. First one to see through my crazy trick can take a cookie from the jar in the kitchen!

The cookie goes to Matthew (check the comments).

Explanation: You can set labels in JavaScript (as explained in an earlier post) by adding a colon to a name, and all a URL does is create a label with the name ‘http’. As the double slash is following the colon, the JavaScript interpreter only recognises a label followed by a comment.

Share on Mastodon (needs instance)

Share on Twitter

My other work: