Created
November 27, 2017 13:34
-
-
Save seogi1004/f31a8b72f53c0753c86afa678d6b2072 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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