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 () { | |
| const items = [ | |
| '🍭', | |
| '❌', | |
| '⛄️', | |
| '🦄', | |
| '🍌', | |
| '💩', | |
| '👻', | |
| '😻', |
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
| body { | |
| width: 100vw; | |
| height: 100vh; | |
| margin: 0; | |
| padding: 0; | |
| } | |
| #app { | |
| width: 100%; | |
| height: 100%; |
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
| <div id="app"> | |
| <div class="doors"> | |
| <div class="door"> | |
| <div class="boxes"> | |
| <!-- <div class="box">?</div> --> | |
| </div> | |
| </div> | |
| <div class="door"> | |
| <div class="boxes"> |
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 anagrams = (word, words) => { | |
| const sortedWord = word.split('').sort().join(''); | |
| return words.filter(item => | |
| item.split('').sort().join('') === sortedWord | |
| ); | |
| }; | |
| anagrams('abc', ['cba', 'bac', 'trk']); |
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 fizzBuzz(num) { | |
| num = parseInt(num); | |
| if (!(num % 3) && !(num % 5)) | |
| return 'FizzBuzz'; | |
| else if (!(num % 3)) | |
| return 'Fizz'; | |
| else if (!(num % 5)) | |
| return 'Buzz'; |
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 fizzBuzz(num) { | |
| num = parseInt(num); | |
| if (!(num % 3) && !(num % 5)) | |
| return 'FizzBuzz'; | |
| else if (!(num % 3)) | |
| return 'Fizz'; | |
| else if (!(num % 5)) | |
| return 'Buzz'; |
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
| window.addEventListener('message', event => { | |
| let message = event.data; | |
| }); |
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
| // getting the window from an iframe | |
| let targetWindow = iframe.contentWindow; | |
| targetWindow.postMessage('Hello World!', 'http://example.com'); |
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
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |