Importance of Precise Language

Computers are literal and precise. To a computer, "two times the sum of four and three" is not the same as "two times four plus three":

console.log(2 * (4 + 3)) // 14
console.log(2 * 4 + 3) // 11

Because computers are extremely strict in the way they interpret commands, it's important that we use precise language when talking about programming.

In the following example, the variable phone is declared and then assigned to the value "addicted".

var phone;
phone = "addicted";

Novice programers are tempted to say the variable phone equals the value "addicted", but that is not correct. Variable assignment is completely different than equality comparisons.

var butterfly = "pretty"; // variable assignment
42 === 35; // equality comparison

In the following statement, 4 and 5 are referred to as operands and + is the operator.

console.log(4 + 5);

In the following statement, typeof() is the operator and false is the operand.

typeof(false);

We've taken great care to make the language in this book concise and precise. Make a concerted effort to study this language and use it exactly. Exact language will accelerate your learning process.

Question Click to View Answer

Describe the following code using precise language.

var yummy;
yummy = "cookies";

The variable yummy is declared. yummy is assigned to the value "cookies".

Describe the following code using precise language.

var nice = "spa weekend!";
console.log(nice);

The variable nice is declared and assigned to the value "spa weekend!". The value that is assigned to the variable nice is then printed to the console.

Identify the operands and operator and in the following statment.

3 * 45;
* is the operator.

3 and 45 are the operands.

Identify the operand and operator and in the following statment.

typeof(4.44);

typeof() is the operator.

4.44 is the operand.

<-- Previous (More Variable Reassignment) Next (Introduction to Types) -->