Skip to content

Instantly share code, notes, and snippets.

@seogi1004
Created November 27, 2017 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seogi1004/f31a8b72f53c0753c86afa678d6b2072 to your computer and use it in GitHub Desktop.
Save seogi1004/f31a8b72f53c0753c86afa678d6b2072 to your computer and use it in GitHub Desktop.
var People = function(name, age) {
var name = name;
var age = age;
var isAdult = function() {
if(age > 19) return true;
else return false;
}
this.viewMyInfo = function() {
if(isAdult()) {
return name + "님은 성인이 맞습니다.";
} else {
return name + "님은 성인이 아닙니다.";
}
}
}
var people = new People("Moon-Hak-I", 26);
alert(people.isAdult()); // Uncaught TypeError: Object [object Object] has no method 'isAdult'
alert(people.viewMyInfo());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment