Skip to content

Instantly share code, notes, and snippets.

@mindmergedesign
Created October 15, 2017 16:46
Show Gist options
  • Select an option

  • Save mindmergedesign/bec77a39b89976c47dc7e64038ed4cc1 to your computer and use it in GitHub Desktop.

Select an option

Save mindmergedesign/bec77a39b89976c47dc7e64038ed4cc1 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/sugoluv
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
var todoList={
todos: ['exercise', 'drink', 'sleep', 'work'],
showTodos: function(){
console.log(this.todos);
},
addTodo: function(todo){
this.todos.push(todo);
this.showTodos();
},
editTodo: function(index, newValue){
this.todos[index] = newValue;
this.showTodos();
},
deleteTodo: function(index){
this.todos.splice(index, 1);
this.showTodos();
}
};
</script>
<script id="jsbin-source-javascript" type="text/javascript">var todoList={
todos: ['exercise', 'drink', 'sleep', 'work'],
showTodos: function(){
console.log(this.todos);
},
addTodo: function(todo){
this.todos.push(todo);
this.showTodos();
},
editTodo: function(index, newValue){
this.todos[index] = newValue;
this.showTodos();
},
deleteTodo: function(index){
this.todos.splice(index, 1);
this.showTodos();
}
};</script></body>
</html>
var todoList={
todos: ['exercise', 'drink', 'sleep', 'work'],
showTodos: function(){
console.log(this.todos);
},
addTodo: function(todo){
this.todos.push(todo);
this.showTodos();
},
editTodo: function(index, newValue){
this.todos[index] = newValue;
this.showTodos();
},
deleteTodo: function(index){
this.todos.splice(index, 1);
this.showTodos();
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment