Why? 4 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

Why? 4

What is the output of this code? var x = 8; var y = 4; x += y; x /= y; alert(y); answer 4

17th Feb 2019, 3:49 PM
Алмат Айтбаев
Алмат Айтбаев - avatar
2 Answers
+ 7
Ah trick question. You are changing only the x value all the time. Y remains the same as initially, 4, and in the end y is alerted.
17th Feb 2019, 3:52 PM
Tibor Santa
Tibor Santa - avatar
+ 4
All right! This is a question for which attention is required. which sometimes we lose this attention. Thank you friend for help ☺️👍
18th Feb 2019, 1:12 AM
Алмат Айтбаев
Алмат Айтбаев - avatar