Skip to content

Instantly share code, notes, and snippets.

@rtablada

rtablada/memory.md

Last active Mar 14, 2020
Embed
What would you like to do?
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