Last active
March 22, 2018 16:31
-
-
Save a1exlism/143d1b67d2245a94106d37d706390515 to your computer and use it in GitHub Desktop.
This file contains 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
// core function | |
Function.call() | |
indexOf() | |
// factory usage | |
let ul = document.querySelector('ul'); | |
ul.addEventListener('click', function(event) { | |
if(event.target.nodeName === 'LI') { | |
alert(Array.prototype.indexOf.call(ul.childNodes, event.target)); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment