Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on I miss the programmable web (2021). Parent comment
The {} prevents the code from evaluating to a value that the browser then would use as the new value for the DOM, overwriting the existing page.
Try bookmarking javascript:123 and see what happens when you click it.
Bookmarklets are URLs, so a newline in the code would be urlencoded as %0A. So you could do:
javascript:alert(1)%0Aalert(2)
But I would prefer:
javascript:alert(1);alert(2)
There are no comments on this comment yet.
The {} prevents the code from evaluating to a value that the browser then would use as the new value for the DOM, overwriting the existing page.
Try bookmarking javascript:123 and see what happens when you click it.
Bookmarklets are URLs, so a newline in the code would be urlencoded as %0A. So you could do:
javascript:alert(1)%0Aalert(2)
But I would prefer:
javascript:alert(1);alert(2)