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){
   = name;
        getName : function(){
            alert('Student name is' +;

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

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