guys i am trying to learn some javascript and i have a question that i think is important to ask. so what i have gotten so far is that when i do something like this:
var a=function(){}
during the creation phase there will be created in memory a variable (a
) with undefined value and during the execution the a
will point to the memory slot where the function lies.
so what happens to the old spot a was pointing at(the one with undefined value)? also if i set b
equal to a
this means they will point to the same memory slot right?
what happened to the slot that b was previously pointing at?
finally does the function gets saved to the memory during the creation phase but cant be called because nothing points at it or its just get saved during the execution phase?
thanks i hope you can help me make my mind clear (i cant sleep with these questions on my head :D)