I came across this in some example code and I am completely lost.
const addCounter = (list) => {
return [...list, 0]; // This is the bit I am lost on, and I don't know about [...list, 0]
}
Apparently the above is equal to the following:
const addCounter = (list) => {
return list.concat([0]);
}
Any suggestion or explaination is much appreciated.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…