Skip to content

Instantly share code, notes, and snippets.

@colevandersWands
Created September 9, 2021 08:52
Show Gist options
  • Save colevandersWands/591c99c65c521cf479c0b7c11dce8e4b to your computer and use it in GitHub Desktop.
Save colevandersWands/591c99c65c521cf479c0b7c11dce8e4b to your computer and use it in GitHub Desktop.
address specific misconceptions in markdown MCCs
'use strict';

let thing = 'dog';

console.log(thing);

thing = 'cat';

what will be logged to the console?

A. "thing"

nope. "thing" is the name of the variable, not the value stored inside it.

when you log a variable to the console the value will be displayed.

B. "dog"

correct! The log statement is before the reassignment, so it will log the first value stored in thing.

C. "cat"

nope. "cat" is assigned to thing after the log statement.

what is the final value of the variable?

A. "thing"

nope. "thing" is the name of the variable, not the value stored inside it.

the only way to have "thing" stored in our variable would be to assign that string value:

let thing = 'dog';

thing = 'thing';
B. "dog"

nope. "dog" is the initial value of our variable, but the variable is reassigned on the last line.

C. "cat"

correct! "cat" is the last value assigned to the variable in this program. it's final value will be "cat".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment