javascript - Scope inside constructor -
i have instance of constructor called slideshow , wanted know scope of variable key word var be. understand refers object not sure scope itemwidth be. presume local function if function global mean var inside too? can var itemwidth accessed anywhere else?
function slideshow( width, height ){ this.width = width; this.height = height; var itemwidth = 400; }
i presume var inside update method part of objects prototype object local function , not global.
slideshow.prototype.update = function( dir ){ var dir = value; }
function
defines scope. declared inside function var
local, , visible inside function (or functions declared inside it). in both of examples, var in question visible inside function.
Comments
Post a Comment