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

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -