Changed ain the main file. Then turn on a.jsand b.js. JS files have the following contents.
a.js
a+=100;
b.js
a=+200;
And the main file :
<script type="text/javascript">
a=30;
</script>
<script type="text/javascript" src="js/a.js"></script>
<script type="text/javascript" src="js/b.js"></script>
a+=90;
console.log("a = " + a);
</script>
The console shows a=290. Why anot 420 (i.e. 30 + 100 + 200 + 90)? why adoes not change to a.jsand b.js?
source
share