0

does return ignores the operation after it?

function y(a){ return --a; a*=5; } document.write(y(8)); //why the answer is 7?

15th Sep 2016, 12:41 PM
muhammad aqmal
muhammad aqmal - avatar
3 odpowiedzi
+ 2
Yep.
15th Sep 2016, 12:43 PM
Zen
Zen - avatar
+ 2
Note that if it was 'return a--;' it would return 8
16th Sep 2016, 9:40 AM
Niv Brenner
Niv Brenner - avatar
0
thank you👋
15th Sep 2016, 12:51 PM
muhammad aqmal
muhammad aqmal - avatar