0
comment not a question really...
Just noticed on the Comparison Operator section that on the example shown below it reads. var num = 10; //num ==8 will return a false I think it should be wrote as... var num ==10; //num ==8 will return a false Anyways.. Do not want to be the "SYNTAX POLICE" but noticed this and belief this is just a Syntax error/Typo. Thoughts?
6 Respuestas
+ 4
Josh.Reese🐼💨🔥 Check here what is the difference among these
=, == and ===
https://www.c-sharpcorner.com/article/difference-between-and-in-javascript2/
+ 3
What they are saying is, first you store `10` in `num`:
var num = 10;
Then, if you compare that variable to `8`, the result will be `false`:
if(num == 8)
alert("10 is equal to 8 lmao");
else
alert("no way jose");
Try it in the code playground:
https://code.sololearn.com/WMQu57YqdkFk/?ref=app
The first operator `=` is assignment, you are telling the variable what value it is. The second `==` is comparison, you are asking the variable whether it is equal to a value.
+ 2
Josh.Reese🐼💨🔥 First you should know about Single equal sign (=) and double equal sign (==) then you will know that
var num = 10 is correct not var num == 10
+ 2
Thank You everyone for your comments, as definately was wrote RIGHT and I was definately wrong. ✅I haven’t messed with code in many years, but back out in society and trying to do RIGHT. Thank You everyone for your time and comments , as I will load a virtual bowl of dank for your Water Pipe.
✌🏻😁💨
+ 1
yes . definately false but think the problem should read.
var num==10; instead of var num=10;
🤔