r/JavaScriptTips • u/No_Poetry9172 • Mar 31 '25
JavaScript
what will be the answer>?
**1.**console.log(10n+2);
**2.**console.log( !{} && someFunction() );
**3.**console.log( !-0 + !!Infinity + !null + !!undefined);
4
Upvotes
1
Apr 02 '25
[removed] — view removed comment
1
u/No_Poetry9172 Apr 07 '25
Nope!🥲
1
Apr 07 '25
[removed] — view removed comment
1
u/No_Poetry9172 Apr 09 '25
for 1. //error
2. //false
3. //3 (true+true+true+false)
1
Apr 10 '25
[removed] — view removed comment
1
u/No_Poetry9172 Apr 20 '25
nope => the + operand convert true =1 and false =0, + operand adds everything (1+1+1+0 =3)
1
u/[deleted] Apr 02 '25
So as a guy who only reached if statements and functions so far, what the fuck are those...