alexa

How to use a variable in in an object in a javascript class ?

How to use a variable in in an object in a javascript class ?

Remove functions:

 

 class Example{

    constructor(something){
        this.something = something;
    }

    foo(){

        return this.something
    }
}

const object = new Example("among")

console.log(object.foo())

320 0
7

Write a Comments


* Be the first to Make Comment

GoodFirms Badge
GoodFirms Badge

Fix Your Meeting With Our SEO Consultants in India To Grow Your Business Online

Facebook
Twitter
LinkedIn
Instagram
Whatsapp
Call Now
Quick Inquiry