'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".