Message from JavaScript discussions

August 2020

— Can u explain in more detail ?

— 

So,push changes the the original array value and when in the next iteration as the value already changed ( coz we used push ) it doesn't work ?

— Exactly. let me try it myself . 1 second

— Ok. .push would have also worked - but it does not return the array, it returns the new length of the array

Message permanent page

— If you do result.push('whatever'); return result that would work

— But concat is a lot better here, because we can use the return value directly, and we do not need to mutate anything

Message permanent page

— Thanks mate🤝

— Example:

[1,2,3].reduce((result, item) => {
result.push(item)
return result
}, [])

— Have someone using vuejs ?

— I using axios to get Data, please tell me why first object is observer?

— You are probably using vuejs and vuejs is adding observable to all data points that are used in the template.

Message permanent page

— Or: anything that gets stored to data or comes from computed