I am new to Javascript (JS). I have two questions after reading JS book.
1.
if I write:
<script>
location=”
setInterval(m,300);
function m()
{
alert(“Hello”);
}
</script>
, the browser executes m() for a short while before the google page is fully loaded. Does this mean the browser listens to the instructions from the JS interpretor? The situation is like an employee(browser) and an employer(interpretor)?
2.
If I set
document.bgColor=”blue”;,
the browser immediately changes the background color to blue.(before the control flow reaches </script>).
Questions is: generally in what situation, the browser adopts the change immediately? I think if I add a new property of a window object, say
window.newproperty=”anything”;, the browser refreshes the contents is a waste of resourses.