With ES6 you can simply do:
const spanList = [...document.querySelectorAll("span")];
More Related Contents:
- Why doesn’t nodelist have forEach?
- Why is the loop assigning a reference of the last index element to? [duplicate]
- How to set DOM element as first child?
- Array value is replaced when second one stores in php
- Making new array and push there keys on that new array [closed]
- How do I empty an array in JavaScript?
- How can I add new array elements at the beginning of an array in JavaScript?
- Why is using “for…in” for array iteration a bad idea?
- How to pass arguments to addEventListener listener function?
- Remove array element based on object property
- Sorting an array of objects by property values
- Setting innerHTML vs. setting value with Javascript
- javascript access parent DOM across domains?
- How to check if an array is a subset of another array in JavaScript?
- jQuery: how to change tag name?
- Get the string representation of a DOM node
- Javascript – Sort Array of objects by 2 Properties
- Count immediate child div elements using jQuery
- Attach event listener through javascript to radio button
- Recursively filter array of objects
- Check whether HTML element has scrollbars
- How to calculate intersection of multiple arrays in JavaScript? And what does [equals: function] mean?
- Convert an array to an array of objects
- use Lodash to sort array of object by value
- How to convert array of key–value objects to array of objects with a single property?
- Find closest date in array with JavaScript
- JavaScript: get the current executing node? [duplicate]
- Can a JavaScript variable be used in plain HTML?
- Can forEach in JavaScript make a return? [duplicate]
- Why is iframe.contentWindow == null?