0
What is the difference between spread and rest operator in JavaScript
2 Antworten
+ 3
In short, REST collects all the remaining elements into an array whileSpread operator allows arrays/objects/strings to be expanded into single arguments/elements.
https://www.google.com/url?sa=t&source=web&rct=j&url=https://codesquery.com/javascript-rest-vs-spread/%3Famp&ved=2ahUKEwiC9-Wth_LqAhVvzDgGHQQCAk4QFjABegQIEhAH&usg=AOvVaw0lik5lJAZqihMUblwGYC06&cf=1
+ 1
rest operator is passed in argument of a function to accept arguments as many as you want.
spread operator is used to copy arrays and objects.https://code.sololearn.com/WsQ0aJJuN0k5/?ref=app