Is there some difference between using Array.from(document.querySelectorAll('div'))
or [...document.querySelectorAll('div')]
?
Here is a example:
let spreadDivArray = [...document.querySelectorAll('div')];
console.log(spreadDivArray);
let divArrayFrom = Array.from(document.querySelectorAll('div'));
console.log(divArrayFrom);
The console.log()
will log the same result.
Is there any performance difference?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…