I was sure this expression
const arr = [1,2,3]
console.log(arr)
arr.push(4)
Should return [1,2,3]
. Actually, if write it in the browser console it'll return what expected. But I accidentally open codesandbox and write the same code there and I got as the answer is [1,2,3,4]
. And I'm really confused in my knowledge :) I don't know why it's happening. I think it's because of bundler, I tried Parcel and WebPack bundlers both have the same result. But as I said I'm not sure. If anyone knows I would love to read it.