1//create an array like so:
2var colors = ["red","blue","green"];
3
4//you can loop through an array like this:
5for (var i = 0; i < colors.length; i++) {
6 console.log(colors[i]);
7}
1console.log(Array.from('foo'));
2// expected output: Array ["f", "o", "o"]
3
4console.log(Array.from([1, 2, 3], x => x + x));
5// expected output: Array [2, 4, 6]
6
1// Create an array based on a property of DOM Elements
2const images = document.getElementsByTagName('img');
3const sources = Array.from(images, image => image.src);
4const insecureSources = sources.filter(link => link.startsWith('http://'));