LHS & RHS Look Ups

March 27, 2018
Web JavaScript

LHS and RHS stand for Left Hand Side and Right Hand Side of an assignment operation. This allows for us to break down the code and analyze exactly what is happening.

For the first part post, we are going to be analyzing the following program

This program actually breaks the LHS and RHS look ups into two different statements.

The LHS of the assignment operation will look up the variable container and assigns a value to that container. In the program, var a = 2; looks for the variable a and assigns it the value of 2, so that categorizes the statement as a LHS look up.

The RHS of the assignment operation will look up a value of a variable. In the program, console.log(a); looks for the value of a and outputs that value, which in this case is 2.

Now, let’s look at a program that has both a LHS and a RHS look up.

The LHS look up of this program is foo(2);. That is because when foo is called, a is assigned the value 2. The RHS look up in this program is console.log(a); since the program has to look up the value of a to perform the console.log.


If you enjoy my posts, streams, and apps, consider buying me the juice of life that is coffee.

or support my work monthly on Patreon.