Skip to content

Instantly share code, notes, and snippets.

@pycraft114
Created March 16, 2017 01:48
Show Gist options
  • Save pycraft114/1cb473d2f533ba066911e4e5d57948eb to your computer and use it in GitHub Desktop.
Save pycraft114/1cb473d2f533ba066911e4e5d57948eb to your computer and use it in GitHub Desktop.
function Health(name,lastname){
this.name = name;
this.lastname = lastname;
}
var a = Health("chanwoo","park"); //return값이 없기때문에 a는 언디파인드, 윈도우에 네임 변수를 생성했기때문에 'chanwoo'출력
console.log(name);
var allFuntions = {
addtask:function(task){
this.todolist.push(task);
},
completedTask:function(task){
var index = this.todolist.indexOf(task);
this.completed.push(task);
this.todolist.splice(index,1);
},
showList:function(){
console.log(this.todolist);
}
};
var firstTodolist = Object.create(allFuntions);
firstTodolist.todolist = [];
firstTodolist.completed = [];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment