app.js
// Add a new expense into object
Add a new expense into object
Add a new expense into object
addExpense(){
    if(this.description.value == '' || this.amount.value == '') return false;
    if(isNaN(this.amount.value)) return false;
    let newElement = {}
    this.expenseID = this.uuidv4();
    newElement.id = this.expenseID;
    newElement.description = this.description.value;
    newElement.amount = this.amount.value;
    this.expenseObj.push(newElement);
    this.resetFields();
    this.clickEdit = true;
    return true;
  }
addExpense ( ) { if ( this . description . value == '' || this . amount . value == '' ) return false ; if ( isNaN ( this . amount . value ) ) return false ; let newElement = { } this . expenseID = this . uuidv4 ( ) ; newElement . id = this . expenseID ; newElement . description = this . description . value ; newElement . amount = this . amount . value ; this . expenseObj . push ( newElement ) ; this . resetFields ( ) ; this . clickEdit = true ; return true ; }
Add a new expense into object
Add a new expense into object