Spread Operators & Rest Parameter
Another example
y@pne agypanamepg [Link].u.s
const arr = I 's 213^4153
# Rest Parameter comet c- a. b. → •
rests -
-
arr
elements into
A collects all
remaining array
* p, , none,
Arguments keyword
Before rest parameters existed, to get all the arguments in a function we used arguments which is an array-like
object.
function someFunction() {
return arguments;
}
someFunction("joykare", 100, false);
someFunction returns the arguments and their indexes, [Arguments] { '0': 'joykare', '1': 100, '2': false }.
The downside of using the arguments keyword is that, it returns an array-like object; this means you
essentially cannot perform any array-methods like; [Link], [Link]. Another pitfall, is that we cannot use
arguments in arrow functions. This is because arrow-functions do not have their own this, and hence no
arguments object either.
[Link]
* Spread operator
→
unpaeke 1 expands elements
it be used in
→ not
only corsage can
any
iteration like
array string object, ,
g- concatenating garage
copying arrays
adding new elements / fields
Toothy or
Falsy
methods
for assigning
Nallish
Coalescing Operators? :D default Valens
Its side of
* a
logical operator raters Rite it when
kits is null 00
undefined
* usually is used for assigning default value when
fits is null ,
undefined ,
"
,O , NaN
optimal chaining operator
let
foo =f some
Prop : hi }
log Cfoo some
Prop
?
tooppossccase ??
" "
console . -
• NA '
↳ HI
logcfoo Prop ?• [Link] ? ?
"
console . - some Other NA ;
"
↳ NA