Declare Private Members in Class:

Use JavaScript closure to create private members of the class as below:

Ext.define('Student', function(){
    var name = 'unnamed';
    
    return {
        constructor : function(name){
            this.name = name;
        },
        getName : function(){
            alert('Student name is' + this.name);
        }
    };
});

//create an object of Student class
var studentObj = Ext.create('Student','XYZ');
studentObj.getName();

You cannot access name directly as it is a private member. Use getName() method on student object to access name.