Spread and Rest Operators in JavaScript
HTML-код
- Опубликовано: 15 сен 2024
- n JavaScript, the spread and rest operators are both represented by three dots (...), but they serve different purposes.
Spread Operator (...):
- The spread operator allows an iterable (like an array or a string) to be expanded into individual elements. It is used to split up array elements or object properties.
- When used with arrays, it can be used to copy an array, concatenate arrays, or pass elements of an array as arguments to a function.
- With objects, it can be used to create shallow copies of objects, merge objects, or clone objects with new properties.
Rest Parameter (...):
- The rest parameter syntax allows you to represent an indefinite number of arguments as an array.
- It is used in function definitions to capture multiple arguments into a single array parameter.
- The rest parameter must be the last parameter in a function.
Varargs in java are similar to rest operator😮
i am currently working on note zipper app and have almost finished it but i am stuck at the redux , coz i want to use redux toolkit and I am currently learning redux toolkit so can you make a dedicated video for redux toolkit and a small sample project on how can we implement it in projects please?
Learn Next js u which is a react framework,,U don't need to learn redux,next js will take care of it...
@@soulsnakers5919let him learn redux...cause interview will be redux there
@@soulsnakers5919how ?
The opinion about Nextjs is just enough is valid. Redux will cause you tons of pain. If you need proper state library, there are tons, my favorite is react-query. If you write good code, then it will be much easier to support.
❤
I got it very fast
Can we use concat?
Or use Array.flat over the whole thing, same result.
From where did you learn all these additional things sir pls help and provide resources to learn additional things except the findamentals🙏🏼
here - roadsidecoder.com/
Thank you sir
Bhaiya dsa ka video banao for java script
Javascript se dsa karne ki jagah Java se hi karlo
@@laughingbrick4824 javascript seems easy, heaven for a web developer
Already bana chuka
Sir ,should we take this
what?
Can't we use concat instead
Spread operator is more easy to use while using backend than concat.
redux me ye jyada better rehta hai jab array object me Hoti hai
Bro thinks he did something by making a basic tutorial when thousands already exist
Well you gave me a view, so I succeded 😎
No thanks