Define Constructor:

To define a custom class with constructor, add function name constructor as a class member:

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

Now you can create an object by passing parameter to the constructor:

var studentObj = Ext.create('Student','XYZ');
var studentObj = new Student('XYZ');
//output: Student name is XYZ

Try it on