0

What will be the output ?

let a,b,c a=1 b=5 c=7 if(++b - a == b++) { console.log(b) } else{ console.log(c-b) }

13th Aug 2020, 6:34 AM
nitin soni
nitin soni - avatar
1 Resposta
+ 3
It took me a while to understand but, look: ++b inside if condition increases b by 1 so b is now 6 and the condition is that: if ( 6 - a == 6 ) which is false ELSE block would be executed under it. ++a and a++ both have increased b by 1 so now b is 7. Inside ELSE: c - b = 7 - 7 = 0 would be the output
13th Aug 2020, 7:12 AM
maf
maf - avatar