function addTodo(text) {
        var todo = {
            _id: new Date().toISOString(),
            title: text,
            endDate: new Date(),
            notes: "",
            completed: false
        };
        db.put(todo).then(function (result) {
            console.log('Added new todo');
        }).catch(function(err) {
            console.log('Failed to create new todo.');
        });
    }
// We have to create a new todo document and enter it in the database
We have to create a new todo document and enter it in the database
We have to create a new todo document and enter it in the database
function addTodo(text) {
        var todo = {
            _id: new Date().toISOString(),
            title: text,
            endDate: new Date(),
            notes: "",
            completed: false
        };
        db.put(todo).then(function (result) {
            console.log('Added new todo');
        }).catch(function(err) {
            console.log('Failed to create new todo.');
        });
    }
function addTodo ( text ) { var todo = { _id : new Date ( ) . toISOString ( ) , title : text , endDate : new Date ( ) , notes : "" , completed : false } ; db . put ( todo ) . then ( function ( result ) { console . log ( 'Added new todo' ) ; } ) . catch ( function ( err ) { console . log ( 'Failed to create new todo.' ) ; } ) ; }
We have to create a new todo document and enter it in the database
We have to create a new todo document and enter it in the database