Skip to main content
Update capitalization and grammar
Source Link
Joseph Cho
  • 4.3k
  • 4
  • 29
  • 36

Perhaps you want something like this:

class Select {
    constructor(el,input){
        this.el = el; 
        this.input = input
    }
input;
    autoExecute(){
        // IThis needcode thesewill functionautoExecute towhen executeyou immediately;construct an object
        console.log(this.input);
    } 
}

You can run this code in the console with something like:

var a = new Select("hi", "bye");
a.autoExecute();

Perhaps you want something like this:

class Select {
    constructor(el,input){
        this.el = el; 
        this.input = input
    }

    autoExecute(){
        // I need these function to execute immediately;
        console.log(this.input);
    } 
}

You can run this code in the console with something like:

var a = new Select("hi", "bye");
a.autoExecute();

Perhaps you want something like this:

class Select {
    constructor(el,input){
        this.el = el; 
        this.input = input;

        // This code will autoExecute when you construct an object
        console.log(this.input);
    }
}

You can run this code in the console with something like:

var a = new Select("hi", "bye");
Source Link
Joseph Cho
  • 4.3k
  • 4
  • 29
  • 36

Perhaps you want something like this:

class Select {
    constructor(el,input){
        this.el = el; 
        this.input = input
    }

    autoExecute(){
        // I need these function to execute immediately;
        console.log(this.input);
    } 
}

You can run this code in the console with something like:

var a = new Select("hi", "bye");
a.autoExecute();