I found these statements on W3Schools:
With JavaScript, the global scope is the complete JavaScript environment. In HTML, the global scope is the window object. All global variables belong to the window object. Your global variables (or functions) can overwrite window variables (or functions).
Don't these statements mean that global and window variables are basically same?
And can I access a window variable from another window, since it is associated with the window object or is the window object deleted once we navigate to another window?
And this one too:
Any function, including the window object, can overwrite your global variables and functions.
And an associated example as:
<p>
In HTML, all global variables will become window variables.
</p>
<p id="demo"></p>
<script>
var carName = "Volvo";
// Code here can use window.carName
document.getElementById("demo").innerHTML = "I can display " + window.carName;
</script>
What is a window object/variable and how does it differ from a global object/variable?
I am really confused. What is the explanation, preferably with an example?