+ 1

What will be alerted??

var a='7'; var b='9'; alert(a+b %7); //Answer is 72 Does anyone know how the answer came about?

22nd Feb 2021, 4:19 AM
S.P. Karthee
S.P. Karthee - avatar
1 Answer
+ 5
Because b='9'; b%7='9'%7=2 (type of number) a='7'; a+b%7 (b%7= 2) '7'+2= ' 72' (type of string) //type of your output is string
22nd Feb 2021, 4:31 AM
SAN
SAN - avatar