DEV Community

Qu-Ack
Qu-Ack

Posted on

TO-DO-LIST 05

In Motion Continues We have started. The plan would be to make a console app first without any dom manipulation.

First Thing I did was decide what my app will be able to do and I landed on three features.
1) Date
2) Priority
3) Name And Description

I will achieve this my making a Task Object using a factory function.

const Task = (name , desc) => {
    const date = new Date();
    const priority = "boring"; 
    const Name = name;
    const Desc = desc;  


    return {date , priority, Name, Desc , render}
}
Enter fullscreen mode Exit fullscreen mode

Now It's of no use unless we don't store it somewhere so we created a TaskModule that is gonna take care of adding and removing tasks in a Task array

const TaskModule = (function() {
    const Tasks = []

    function addTask(task) {
        Tasks.push(task);

    }

    function removeTask(index) {
        Tasks.splice(index, 1);
    }

    return {Tasks , addTask}
})()
Enter fullscreen mode Exit fullscreen mode

I will get to coding but feel free to give suggestions about my approach. In Motion Ends

Top comments (0)