Last active
September 18, 2017 12:41
-
-
Save imparvez/d8c4d7aa6f7753c2d27a73bb5fc1216b 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
// V1 Arrays | |
// It should have a place to store todos | |
// It should have a way to display todos | |
// It should have a way to add new todos | |
// It should have a way to change a todos | |
// It should have a way to delete a todos | |
/*********************************************/ | |
// 1. It should have a place to store todos | |
var todos = ['item 1', 'item 2', 'item 3']; // List in JavaScript with the help of ARRAY | |
// 2. It should have a way to display todos | |
console.log('My Todos: ', todos); // // My Todos: ["item 1", "item 2", "item 3"] | |
// 3. It should have a way to add new todos | |
todos.push('item 4'); | |
console.log('My Todos: ', todos); | |
todos.push('item 5'); | |
console.log('My Todos: ', todos); | |
// 4. It should have a way to change a todos | |
todos[0] = 'item 1 updated' | |
console.log('My Todos: ', todos); | |
todos[3] = 'item 4 updated' | |
console.log('My Todos: ', todos); | |
// 5. It should have a way to delete a todos | |
todos.splice(0,1); // 'item 1 updated' | |
console.log('My Todos: ', todos); // ["item 2", "item 3", "item 4 updated", "item 5"] | |
todos.splice(0,3); // 'item 1 updated' | |
console.log('My Todos: ', todos); // ["item 5"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment