Last active
December 28, 2015 18:12
-
-
Save ahmedelgabri/e0dab8bfae1c3b5ed8d0 to your computer and use it in GitHub Desktop.
JS helper functions
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') or $('.class', $('div')) | |
| const $ = (selector, parent) => (parent || document).querySelector(selector) | |
| // $$('div') or $$('.class', $('div')) => returns a real Array not a NodeList | |
| const $$ = (selector, parent) => [...(parent || document).querySelectorAll(selector)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment