From the course: JavaScript Essential Training
Unlock the full course today
Join today to access over 24,200 courses taught by industry experts.
Assignment vs. comparison - JavaScript Tutorial
From the course: JavaScript Essential Training
Assignment vs. comparison
- [Instructor] You've probably noticed in JavaScript, the equal symbol is not used the same way we use it in math. In JavaScript, the equal symbol means assignment. The value on the right side is assigned to the container on the left. Anytime you see a single equal symbol, it's an assignment of a value to a variable. We also use equal symbols for comparison and that's what you see down here. We have two equal symbols next to one another, And that says, we're looking to see if the value of A equals the value of B. Are they the same or not? This code example in the exercise files is a really basic example to demonstrate how these different comparisons work. What we're doing here is just assigning a value to A and B and then we're console logging out, what the values are and also the type of data that's inside, each of these variables. Why we're doing that will become apparent in the second. Then we use a basic conditional…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
Variables: Containers for everything2m 31s
-
(Locked)
Var3m 15s
-
(Locked)
Scope3m 37s
-
(Locked)
Let4m 34s
-
(Locked)
Const2m 58s
-
(Locked)
Data types3m 7s
-
(Locked)
Assignment vs. comparison4m 35s
-
(Locked)
Math operators6m 13s
-
(Locked)
Challenge intro: Calculate sales tax1m 35s
-
(Locked)
Solution: Calculate sales tax3m 30s
-
-
-
-
-
-