HomeBlogHow to use a variable in in an object in a javascript class ?Problem and SolutionsHow to use a variable in in an object in a javascript class ?By M.K. Verma · 3 May 2022Remove functions: class Example{ constructor(something){ this.something = something; } foo(){ return this.something } } const object = new Example("among") console.log(object.foo())Share this:CommentsLeave a commentPost