From f847d5983646276649d65860b71e9c11766de194 Mon Sep 17 00:00:00 2001 From: AbhishekRana <87165058+imabhishekrana@users.noreply.github.com> Date: Thu, 28 Oct 2021 16:42:09 +0530 Subject: [PATCH 1/2] To-Do_List_using_JS --- index.html | 135 ++++++----------------------------------------------- todos.js | 37 +++++++++++++++ 2 files changed, 50 insertions(+), 122 deletions(-) create mode 100644 todos.js diff --git a/index.html b/index.html index 7eb4f2a..2fc2560 100644 --- a/index.html +++ b/index.html @@ -1,132 +1,23 @@ - - - - - - - - - - - - - - - - - Let's Do It | ToDo List + + + + Todo List -
-
-
-
-

- Let's Do It
A Simple ToDo List WebApp -

-
-
-
-
-
-
-
-
-

Add Items to The List

- - - -
-
-
- -
- -
- -
-
-
- -

Your Tasks

- -
-
    - -
    - -

    Completed Tasks

    - -
    -
      -
      -
      -
      -
      -
      -
      -
      - - - + \ No newline at end of file diff --git a/todos.js b/todos.js new file mode 100644 index 0000000..f1c9553 --- /dev/null +++ b/todos.js @@ -0,0 +1,37 @@ +let input = prompt('What would you like to do?'); +const todos = ['Collect Chicken Eggs', 'Clean Litte Box']; +while (input !== 'quit' && input !== 'q') { + if (input === 'list') { + console.log('************************') + for (let i = 0; i < todos.length; i++) { + console.log(`${i}: ${todos[i]}`) + } + console.log('************************') + + } else if (input === 'new') { + const newTodo = prompt('Ok, what is the new todo?'); + todos.push(newTodo) + console.log(`${newTodo} added to the list!`) + } + else if(input === 'delete'){ + const index = parseInt(prompt('Ok, enter an index to delete:')) + if(!Number.isNaN(index)){ + const deleted = todos.splice(index, 1); + console.log(`Ok, deleted ${deleted}`) + } else{ + console.log('Unknown index') + } + } + input = prompt('What would you like to do?') +} +console.log('OK, Quit the app!') + + + + + + + + + + From f662e1c0eed916c0643b36038842a71d09021984 Mon Sep 17 00:00:00 2001 From: AbhishekRana <87165058+imabhishekrana@users.noreply.github.com> Date: Thu, 28 Oct 2021 16:42:52 +0530 Subject: [PATCH 2/2] To-Do list using JS