Code output confusion | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Code output confusion

The output is 4 .how it process? <script> var x= 8; var y= x++ *5; var z=y%x; alert(z); </script>

5th Apr 2019, 12:20 PM
KHUSHbu
KHUSHbu - avatar
4 Answers
+ 5
It would be a better idea to post the code snippet in the description and not the titles.
6th Apr 2019, 2:28 AM
Hatsy Rei
Hatsy Rei - avatar
+ 4
x == 8. y == 8*5 == 40 // x is now 9 because of x++ z == 40%9 == 4.
5th Apr 2019, 12:24 PM
Diego
Diego - avatar
+ 2
Ohk
6th Apr 2019, 3:42 AM
KHUSHbu
KHUSHbu - avatar
+ 1
Ohk now I understand 😊 Thanks man
5th Apr 2019, 12:26 PM
KHUSHbu
KHUSHbu - avatar