ganqqwerty / 123-Essential-JavaScript-Interview-Questions

JavaScript interview Questions
BSD 3-Clause "New" or "Revised" License
5.01k stars 1.18k forks source link

Question 23 #23

Closed viktmv closed 6 years ago

viktmv commented 7 years ago

Hey there, description in question 23 needs a bit of adjustment

Let say new User("xyz") created a object called foo and returned now foo["location"] would be assigned value as USA and person is referencing to foo["location"].

Here, person is not referencing foo["location"], instead it is being assigned the result of Assignment Operator = which in this case returns string 'USA'. Assignment operator always returns the value of the expression on the right, as described here: ECMAScript Specification , pt 12.14.4

Otherwise it's totally correct, thanks for great work!

ganqqwerty commented 6 years ago

This is absolutely right, thanks for the important correction!