javascript – Why is not the browser updating my page?

Well before speaking to me to save my code or see if everything is fine, etc. everything is fine just for example this code

var name;

document.write (name);

It is obvious that it is to return underfined because it has nothing in my variable does not have a defined value, beauty up there all good only that the problem is that when I update the browser simply nothing appears! and when I assign a value to my variable and update the browser, the value appears only if I am there in my code and delete that value and leave my variable without value and return again in the browser simply the value remains there would be as if I had but I do not know what I like most about me.