By contrast, in a = 2, the reference to a is an LHS reference because we don’t actually care what the current value is - we simply want to find the variable as a target for the =2 assignment operation. Instead, we’re looking up to retrieve the value of a so the value can be passed to console.log(…). The reference to a is an RHS reference because nothing is being assigned to a here. The RHS lookup is done when a variable is on the right-hand side of an assignment operation, as in console.log(a). The LHS lookup is done when a variable appears on the left-hand side of the assignment operation, as in the var a = 2 example, where the LHS lookup is trying to find the variable container itself so it can assign. But the question is: to the side of what? To the side o f an assignment operation. Here the author introduces the concept of left-hand side (LHS) and right-hand side (RHS) lookups.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |