+ 4
Operators in JavaScript
I am a little confused by this code could someone be kind enough to explain? The answer is 36, but I don’t understand why. var x = 326; var prod = 1; while (x > 0) { prod *= x % 10; x = (x - x % 10) / 10; } document.write (prod);
6 Réponses
+ 6
I don't know how familiar you are with this stuff so here is a very detailed answer. Open the code and go to the JS tab. Read the comments
https://code.sololearn.com/WMLBCm2P3PpA/?ref=app
+ 5
☺ Happy to help! And the forum is awesome indeed!
+ 5
When it comes to loops you must keep going back until the condition becomes false
+ 4
Of course. Some times I make things more complicated than they are. I need another perspective to remind me... loops loop. Lol thank you, cyk.
+ 3
That is an AWESOME explanation. I got as far as 32 but wasn’t going back each time. Thank you for the very cool and thoughtful response. I get it now. The forum is the best.
0
I need to practice math to dominate this topic. I was a little bit confused as well.