Skip to content

Instantly share code, notes, and snippets.

@rtablada
Last active November 28, 2023 19:21
Show Gist options
  • Save rtablada/81507edfdfce8063be9a7728c7ae7135 to your computer and use it in GitHub Desktop.
Save rtablada/81507edfdfce8063be9a7728c7ae7135 to your computer and use it in GitHub Desktop.
var x = 5;
const name = 'Homer';

let homer = {
  first: name,
  last: 'Simpson'
};

homer.first = 'H';

const marge = {
  first: 'Homer',
  last: 'Simpson'
};

var h = homer;

var family = [homer, marge];

Statement 1: var x = 5;

Identifier Memory Location Value typeof Value Locked
x VAL001 5 number

Statement 2 const name = 'Homer';

Identifier Memory Location Value typeof Value Locked
x VAL001 5 number
name VAL002 'Homer' string 🔒

Statement 3 let homer = { first: name, last: 'Simpson' };

Identifier Memory Location Value typeof Value Locked
x VAL001 5 number
name VAL002 'Homer' string 🔒
homer VAL003 REF:OBJ001 Object
OBJ001 { first: 'Homer', last: 'Simpson } Object

Statement 4 homer.first = 'H';

Identifier Memory Location Value typeof Value Locked
x VAL001 5 number
name VAL002 'Homer' string 🔒
homer VAL003 REF:OBJ001 Object
OBJ001 { first: 'H', last: 'Simpson } Object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment