Does output "1" means "true" here? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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 Respostas
+ 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