What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-20 16:39:02
javascript rest parameters vs spread operator
/** * JS Spread and Rest operators: * Two operators with the same syntax (...) but behave differently */ // Rest parameter: collects all remaining elements into an array. function foo (...args) { console.log(args) } foo(1,2,3,4,5,6) // Output: (6) [1,... Add solution -
Javascript 2021-09-14 09:33:02
how to get first and last element of array in javascript
The rest parameter can only use at the end not anywhere else in the destructuring so it won't work as you expected. Instead, you can destructor certain properties(an array is also an object in JS), for example, 0 for first and index of the last element f... Add solution
Best helpers
Shaples
+5
Tranquilled
+5
Kozuch
+5
Big D Rock
+5
The 313137
+5
Toby Stewart
+5
Moez
+5
Stelle
+5
Kathrin
+5
Moradnejad
+5
Tony_Henrich
+5