Created
November 19, 2014 14:18
-
-
Save shaunwallace/02359278e06f80e0292e to your computer and use it in GitHub Desktop.
Array.prototype.map()
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
// iterating through a collection of elements returned by querySelectorAll | |
var elems = document.querySelectorAll('select option:checked'); | |
var values = [].map.call(elems, function(obj) { | |
return obj.value; | |
}); | |
// reverse a string | |
var str = '12345'; | |
[].map.call(str, function(x) { | |
return x; | |
}).reverse().join(''); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment