3 ms·
Something I just learned about JavaScript: the semicolon is an empty statement, so this is an infinite loop that does nothing.
by ramshorns 8y ago
Something I just learned about JavaScript: the semicolon is an empty statement, so this is an infinite loop that does nothing.
- ygra 8y agoJavaScript shares this trait with a lot of languages that borrow syntax from C.
- gravypod 8y agoA good example of this is a simple strcpy in C: while (a++ = b++);
- TheSoftwareGuy 8y agoI was gonna say you need a dereference operator in there somewhere, but based on that itslicized ‘a’, i think HNs markdown formatting turned them into italics
- deleted 8y ago[deleted]
- umanwizard 8y agoCorrect version (not broken by formatting): while (*a++ = *b++);
- amelius 8y agoHow did you manage to enter it in HN? Is there an escape sequence for asterisk? Or are you using special Unicode codepoints?
- umanwizard 8y agoDouble space at the beginning of a line makes that line verbatim (and monospaced). https://news.ycombinator.com/formatdoc https://news.ycombinator.com/formatdoc