> PS. The other two answers here are outdated.
Sure, the other two answers may be "outdated" but they're still extremely useful if you're looking to calling map/filter/etc against your queried elements.
Sure, the other two answers may be "outdated" but they're still extremely useful if you're looking to calling map/filter/etc against your queried elements.
const elements = document.querySelectorAll('.some-class');
const values = Array.prototype.map.call(elements, element => element.value);
or more idiomatically (and perhaps a little slower): const elements = [...document.querySelectorAll('.some-class')];
const values = elements.map(element => element.value);