Skip to content

Instantly share code, notes, and snippets.

@hakatashi
Created April 27, 2014 11:07
Show Gist options
  • Save hakatashi/11343011 to your computer and use it in GitHub Desktop.
Save hakatashi/11343011 to your computer and use it in GitHub Desktop.
#実用的なhelloworld
String.prototype.capitalize = function() {
return this.charAt(0).toUpperCase() + this.slice(1);
};
var Greet = function(greeting, objection) {
this.greeting = greeting || 'hello';
this.objection = objection || 'world';
this.do = function() {
console.log((this.greeting + ', ' + this.objection + '!').capitalize());
};
return;
}
var helloWorld = new Greet();
helloWorld.do();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment