1- . , Gallery , , undefined.
Gallery.helloworld(), .. undefined.
Helloworld1() , helloworld1 , .
, .
, , .
var Gallery = function(){
return {
helloworld1:function(){alert('hey1')},
helloworld2:function(){alert('hey2')},
helloworld3:function(){alert('hey3')}
}
}();
, . , . Gallery.helloworld1(), .
.
,
var Gallery = function(){
var realGallery = {no_of_pictures:1};
return {
getNumberOfPictures:function(){return realGallery.no_of_pictures;},
increasePictures:function(){realGallery.no_of_pictures += 1;},
decreasePictures:function(){realGallery.no_of_pictures -= 1;}
}
}();
, no_of_pictures realGallery. .
. , , .
, function helloworld() {alert('hey1');}
- . function helloworld(){alert('go away right now !!');}
, - . javascript.