+ 1

Concat vs push

Are these 2 doing the same thing or you use them differently based on certain situations? https://code.sololearn.com/WYVDHl2G453l/?ref=app

14th Apr 2020, 10:51 AM
Sidepocket
Sidepocket - avatar
1 Answer
+ 4
The push() adds elements to the end of an array and returns the new length of the array. ... The concat() method is used to merge arrays.Concat does not change the existing arrays, but instead returns a new array. So we it according to conditions
14th Apr 2020, 10:55 AM
Ayush Kumar
Ayush Kumar - avatar