Skip to content

Instantly share code, notes, and snippets.

@haingdc
Created February 28, 2018 10:39
Show Gist options
  • Save haingdc/57be034864214ef03abe8ec9e2fa5e26 to your computer and use it in GitHub Desktop.
Save haingdc/57be034864214ef03abe8ec9e2fa5e26 to your computer and use it in GitHub Desktop.
A Gentle Introduction to Functional JavaScript: Part 2
var ids = ['unicorn', 'fairy', 'kitten'];
// elements sẽ chứa các phần tử DOM
var elements = [];
for (var i = 0; i < ids.length; i = i + 1) {
elements[i] = document.getElementById(ids[i]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment