Toggle navigation
Genres
Frontend (2)
JavaScript (6)
Database (2)
Linux Server (3)
Web Apps (4)
Misc (4)
Search
List
New Tutorials
Last Modified Tutorials
</>
Code examples
code
smiko
javascript
basic
60object_reference.js
60object_reference.js
/** * Reference */ //Primitive values are not reference types var x = 5; var y = x; y = 8; //only y is modified. x is not modified console.log(x); //5 //Objects are reference types var obj_x = {prop: 13}; var obj_y = obj_x; obj_y.prop = 21; //obj_x.prop is also modified to 21 console.log(obj_x.prop); //21
Reload page
Preview
W3C validation
Edit Code
JS Console