Search code examples
javascriptextjsextjs4

How to delete a property from an Ext object?


How to delete a property from an Ext object ? For example :

Ext.define('Classes.Person', {status:'load',
    config: {
            name: 'Eugene',
            surname : 'Popov'
    },
    constructor: function(config) {
        this.initConfig(config);
    }
  });

var book = Ext.create('Classes.Person') 
/*
console.log(book.status)//load 
console.log( book.surname  )//Popov 
delete book.status
delete book.surname;
 console.log( book.surname  )//Popov 
 console.log(book.status)//load  How delete property ? 
 */

Is there a special method to do so?


Solution

  • Instead of deleting property, delete the value of the property

    console.log(book.status)//load 
    console.log( book.surname  )//Popov 
    book.status = undefined; //remove the existing value
    book.surname = undefined;
    console.log( book.surname  )//undefined 
    console.log(book.status)//undefined