4 ms·
Agreed. I could see how that line could be confusing. Why don't we change it for the better in that case? How about something like this: In the example above w
by mdgrech23 14y ago
Agreed. I could see how that line could be confusing. Why don't we change it for the better in that case? How about something like this:
In the example above we create a new variable sally, and assign it the value bill. Both sally and bill reference the same spot in memory. As such we can't change bill out w/ out changing Sally, specifically when a change is made to an object literal it will affect that object across the entire script.
- SideburnsOfDoom 14y agoSomething like that would be right. How about: In the example above we create a new variable sally, and make it equal to bill. Both sally and bill now reference the same object in memory. Changes made via one affect both of them.
- mdgrech23 14y agoAwesome, you rock! Officially updated the post w/ the above :)
- SideburnsOfDoom 14y agoToday I learned that in ECMAScript5 (IE 9 onwards) there is also a function called Object.Create ( https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/create https://developer.mozilla.org/en/JavaScript/Reference/Global... ) which can be used to copy objects. Kinda.