Skip to content

Instantly share code, notes, and snippets.

@CodeOfficer
Created August 17, 2009 22:53
Show Gist options
  • Save CodeOfficer/169427 to your computer and use it in GitHub Desktop.
Save CodeOfficer/169427 to your computer and use it in GitHub Desktop.
(function(message){
alert(message);
})('hello!');
// -------------------------
var Test = function() {
var message = 'hello';
return {
say: function() {
alert(message);
}
}
};
t = new Test();
t.say();
// -------------------------
var Test = function() {
this.message = 'hello';
};
Test.prototype.say = function() {
alert(this.message);
};
t = new Test();
t.say();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment