Revision: 53287
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 18, 2011 02:43 by luizlopes
Initial Code
var i; for (i = 1; i <= 100; i++) { console.log([!(i % 3) ? 'fizz' : void 0] + [!(i % 5) ? 'buzz' : void 0] || i); }
Initial URL
http://ricardo.cc/2011/06/02/10-CoffeeScript-One-Liners-to-Impress-Your-Friends.html
Initial Description
When you use the `+` operator on an Array, it converts it to a string.` [].toString()` is the same as `[].join(',')`, which gives an empty string in case the array value is `undefined` or `null`. This also works in Javascript `([undefined] + "b" === "b")`.
Initial Title
Elegant FizzBuzz Example
Initial Tags
javascript
Initial Language
JavaScript