LHS = Left Hand Side.
RHS = Right Hand Side.
LHS means the target of the assignment and RHS means the source of the assignment. Check the code below to get an clear idea.
function foo(a) { console.log( a ); // 2 }
foo( 2 );
Can you guess how many LHS references are in this code? there's only one. That is the parameter of the foo() function the variable a, because it's the target of the number 2 (a = 2). When we call that a variable inside the function, it's an RHS reference because we have already declared it and now we only looking for the source of the a not assigning some value to it.
Quiz
Check your understanding so far.
function buz(a) { var b = a; return a + b; } var c = buz( 4 );
- Identify all the LHS look-ups (there are 3!).
- Identify all the RHS look-ups (there are 4!).
1. (a) (parameter of the buz function) , var b = and var c =.
2. = a , a + , + b and buz(2);