Monday, 17 April 2017

is it normal that the array is not modified

Is it normal that

object.array.push('xxx');

does not apply the changes to the array, but it applies changes to objects?

I thought arrays were objects in javascript?!

I'm using the getGlobal function from the remote module https://github.com/electron/electron/blob/master/docs/api/remote.md and changes are not applied to arrays

complete code- main.js:

global.data = {
  items: ['aaa', 'bbb']
};

in renderer.js

remote.getGlobal('data').items.push('xxx');
console.log(remote.getGlobal('data').items); <- no xxx



via thelolcat

No comments:

Post a Comment