Skip to content

Instantly share code, notes, and snippets.

@McLarenCollege
Last active November 29, 2021 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save McLarenCollege/80f45c495c8276416dfe2e3fb93c569c to your computer and use it in GitHub Desktop.
Save McLarenCollege/80f45c495c8276416dfe2e3fb93c569c to your computer and use it in GitHub Desktop.
Exercise : Object Diagram foo bar
// Draw the object diagram for the following code and evaluate the output.
let a = [{ foo: 'x', bar: 'y', k: 0 }, 'oo', [0, 2]]
let b = [a[2], { blah: a }];
b[0][a[1] + 'p'].foo = 'k';
console.log(b[1].blah[0]['f' + a[1]] + 'p');
// TIP: The operators . and [] have equal precedence so evaluate them from Left to Right
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment