This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fizzbuzz = n => `${n % 3 ? '' : 'Fizz'}${n % 5 ? '' : 'Buzz'}` || n; | |
| arr = [...Array(100).keys()] | |
| .map((i) => ++i) | |
| .forEach((i) => fizzbuzz(i)); | |
| console.log(arr); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| console.log(((s)=>[...s].map(c =>(n=c.charCodeAt(0),String.fromCharCode(n^(32*(n>=97&&n<=122))))).join(''))('a4raf32aso"§%&/fu4f22')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function rot13(message){ | |
| return [...message].map((c) => (n = c.charCodeAt(0),String.fromCharCode(n >= 65 && n <= 90?((n - 65 + 13) % 26) + 65:(n >= 97 && n <= 122 ? (n - 97 + 13) % 26 + 97 : n)))).join(''); | |
| } | |
| console.log(rot13('§""§$§Ruby is cool!')); // "grfg" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const variance = (n) => (l = n.length, n.reduce((a, b) => a + ((b - (n.reduce((a, b) => a + b, 0) / l)) ** 2), 0) / l); |
OlderNewer