1

Suppose we have a class called Foo() which takes the value as an argument and has some method method1, metohd2,....

let y = new Foo(56);
console.log(y) // output should be 56 not the class object
y.addOne() // output: adds one to the value
console.log(y) // output should be 57

Can we do this? Not especially with Numbers only, but with other datatypes too?

Bhaumik Joshi
  • 233
  • 2
  • 9

0 Answers0