课程: JavaScript Essential Training

今天就学习课程吧!

今天就开通帐号,24,600 门业界名师课程任您挑!

Assignment vs. comparison

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…

内容