Would this return True? "basketball" = "football" | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Would this return True? "basketball" = "football"

Javascript

28th Feb 2017, 9:00 AM
Bernard Sovdat
4 Answers
+ 15
'=' is the assign operator, which is different from '=='. Use the latter to compare two variables instead of the former. To answer the question though, it would probs return true for ("basketball" = "football") due to the flaw in operator usage. That's for C++, not sure about JS.
28th Feb 2017, 9:04 AM
Hatsy Rei
Hatsy Rei - avatar
+ 3
ok thank you 😀
28th Feb 2017, 9:06 AM
Bernard Sovdat
+ 1
@Hatsy Rei it works the same in js
28th Feb 2017, 10:01 AM
Melvin2204old
Melvin2204old - avatar
0
You are only assigning one to the others here, there is no trace o f comparison so the logical results of true or false cannot hold
30th Jul 2017, 2:34 PM
ibitoye isaac
ibitoye isaac - avatar