= is used to present variable.'Equal to' by '===' Why is 'equal to' presented with only two '=='? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

= is used to present variable.'Equal to' by '===' Why is 'equal to' presented with only two '=='?

29th Feb 2016, 5:40 PM
Toni
7 Antworten
+ 4
x=3, it mean x has value 3. Hence,x equals 3. but for, x==3 it will check 'is the value of x 3?' So,one(=)is for defining a value & other (==) for comparing. While other (===) compares for Type as well as value a variable holding. Example: x=3; y=3; Both are of type integer along with their same value,which is '3'. This will return 'true'
21st Jun 2016, 5:59 PM
Sudarshan Pawar
Sudarshan Pawar - avatar
+ 1
=== is identical (value and type), == is equivalent, i.e. 1 == true, but 1!== true
20th Mar 2016, 1:31 PM
Alessio Lo Vecchio
Alessio Lo Vecchio - avatar
+ 1
identical to check type of var
9th Jun 2016, 5:51 AM
Mohammed Al-Ajlouni
Mohammed Al-Ajlouni - avatar
+ 1
== Equal but may not be of same type. === Both equal and of same type.
18th Jun 2016, 1:33 AM
ZinC
ZinC - avatar
+ 1
=(equal) is used for assigning a value to variable,  == operator will compare for equality after doing any necessary type conversions. The === operator will not do the conversion, so if two values are not the same type === will simply return false. It's this case where === will be faster, and may return a different result than ==. In all other cases performance will be the same.
20th Jun 2016, 1:28 PM
Shakti Singh
Shakti Singh - avatar
+ 1
the = is used to assign values to variables, (a = 5) this, ==, is used to compare values. the == would compare and return 'true' if the values being compared are the same. they could be of the same type or not. that is: if a = 5 (a == 5) would return true (a == '5') would also return true the === is used to compare STRICTLY values of the same type: strings or integers then: if a = 5 (a === 5) would return true: they are of the same type and identical values ( the number 5) (a === '5') this time would return false, as they are of different data types(5--number five and a string--5)
20th Nov 2016, 8:13 PM
Codde Ded
Codde Ded - avatar
0
=== means identical so 10 === "10" will return the boolean false. == means that it is equal, it doesn't what data type it is, so 10 == "10" will return the boolean true.
27th Aug 2016, 3:07 PM
BasicCoder
BasicCoder - avatar