As a newbie i would like to know that if we do
function square(x) { return x*x; }
and
var s = square;
square(4);
So basically the s is a new function in which the square function is copied? cause i am confused in this. please help.
so basically the
sis a new function in which the square function is copied?
No, s is simply another "name" with which you can refer to the same function.
s === square will be true, i.e. both bindings will refer to the same object.
s is a new function in which the square function is copied?No, nowsreferences to thesquare