+ 4

Java script

Var x=1 If(x<2) Document.write(x) Else Document.write(++x) The result here is 1? I got the challenge the result 1 is wrong, and the right answer is 12 , why?

25th Nov 2020, 7:56 AM
شهد
شهد  - avatar
8 ответов
+ 3
Your welcome... Do ask if you have any doubt... I am always happy to help...😊😊😊
25th Nov 2020, 9:58 AM
Steve Sajeev
Steve Sajeev - avatar
+ 6
Each time you writez it is appended to the screen.. First it checks if x < 2, it is so it writes 1. Then it writes x+1 which is 2. So the final result is 12 NOTE There is no else statement correct question Var x=1 If(x<2) Document.write(x) Document.write(++x)
25th Nov 2020, 8:17 AM
Steve Sajeev
Steve Sajeev - avatar
+ 4
There is no else statement... in challenge... but u wrote it in question First it writes 1 then writes 2
25th Nov 2020, 8:09 AM
Steve Sajeev
Steve Sajeev - avatar
+ 3
Please post the screenshot of the challenge question
25th Nov 2020, 8:00 AM
Steve Sajeev
Steve Sajeev - avatar
+ 3
thank u very much 🙏🏼
26th Nov 2020, 12:27 AM
شهد
شهد  - avatar
+ 1
I don't know how to insert pic here, but I put it in my profile
25th Nov 2020, 8:07 AM
شهد
شهد  - avatar
+ 1
what is the write result, I don't understand 👀
25th Nov 2020, 8:15 AM
شهد
شهد  - avatar
+ 1
thank you 👍🏼💚
25th Nov 2020, 8:29 AM
شهد
شهد  - avatar