0

What is the difference = and ==

1st Oct 2023, 6:01 PM
Aditya Adiga
Aditya Adiga - avatar
4 odpowiedzi
+ 5
= for assigning the value. == for checking the condition.
1st Oct 2023, 6:05 PM
Jai
+ 3
Aditya Adiga You did not mention the language which you are referring to. In JavaScript there is also the operator ===. It compares whether two values are equal and of the same type.
1st Oct 2023, 8:01 PM
Jan Markus
0
//Examples: let x = 5; let y = 6; let z = “5”; console.log(x==z)//outputs true because they have the same value console.log(y==z)//outputs false because they don’t have the same value console.log(x===z)//outputs false because they have the same value, but not the same type
2nd Oct 2023, 9:17 PM
Annihilate
Annihilate - avatar