DEV Community

Maegan Wilson
Maegan Wilson

Posted on • Originally published at maeganwilson.micro.blog on

1

LHS & RHS Look Ups

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, please consider sharing it or Buying me a Coffee!

Buy Me A Coffee

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay