Does output "1" means "true" here? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 11

Does output "1" means "true" here?

https://code.sololearn.com/WNBj07dT4lS0/?ref=app I know that true=1,false=0. But , is the answer 1 means true only here or not,i have this doubt Plz explain

20th Sep 2020, 3:44 PM
‎Ashwin Maurya
‎Ashwin Maurya - avatar
7 Answers
+ 5
Yes, in binary, 1 and 0 equal true and false, the plus sign in the bracket makes sure that the value returned is a number, number 1 If you change == to !=, It will return false!
20th Sep 2020, 3:55 PM
Vachila64☕
Vachila64☕ - avatar
+ 4
Answer came 1 because of + alert(typeof a==b); it returns TRUE alert(+(typeof a==b)); Here + operator converts TRUE into integer value 1
20th Sep 2020, 4:24 PM
Bhargava Ram
Bhargava Ram - avatar
+ 4
Vachila64☕ Yeah!😁 Both the answers are same and deserve to be the best answer but i also got confused to mark which one ,so i just marked Bhargava Ram's answer. If you want your answer to be marked ,i am marking it😁😉 And i think it should be also cause you only answered first Thank you☺️💗
21st Sep 2020, 1:05 AM
‎Ashwin Maurya
‎Ashwin Maurya - avatar
+ 3
Bhargava Ram Lol, that is exactly what i said?!! 😂😅😂
20th Sep 2020, 6:50 PM
Vachila64☕
Vachila64☕ - avatar
+ 3
Mr lol Vachila64☕ I'm not said any you answer is right or wrong , even I'm not seen your answer I just given my point of explanation Got it ?!!
21st Sep 2020, 4:32 AM
Bhargava Ram
Bhargava Ram - avatar
+ 3
Yes
22nd Sep 2020, 3:09 PM
Aaditya Pramod Burujwale
Aaditya Pramod Burujwale - avatar
+ 2
Bhargava Ram Lol, I was just saying that we were saying the same thing, that's all😅 maybe you could have said something a bit different cos it is a bit like repition Ashwin Maurya I didn't mean for you to mark mine as best , I just wanted to tell Mr Bhargawa that the answers were the same😅, but thank you anyways 😅
21st Sep 2020, 7:52 AM
Vachila64☕
Vachila64☕ - avatar