examples/todos/public/scripts/app.js
function addTodo(text) {
    var todo = {
      _id: new Date().toISOString(),
      title: text,
      completed: false
    };
    db.put(todo, function callback (err, result) {
      if (!err) {
        console.log('Successfully posted a todo!');
      }
    });
  }
function addTodo(text) {
    var todo = {
      _id: new Date().toISOString(),
      title: text,
      completed: false
    };
    db.put(todo, function callback (err, result) {
      if (!err) {
        console.log('Successfully posted a todo!');
      }
    });
  }
function addTodo ( text ) { var todo = { _id : new Date ( ) . toISOString ( ) , title : text , completed : false } ; db . put ( todo , function callback ( err , result ) { if ( ! err ) { console . log ( 'Successfully posted a 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