- 4
A Class with object parameters
Hi, SoloLearn, Iâm trying to create a constructor in a class, so it accepts an object, so I can do this: Var x = new TargetingClass({ x :2, y:3, z:4}); //What should I do so it can work like this? Console.log(m.target()); //Itâs a method which prints the (x, y, z). I did this: constructor(n) { n = { blah:blah, blah1:blah2, ...} //You get the point. But itâll show an error, that name is already assigned, something like that. I donât know. So, I tried this.n, Now it shows the pairs but doesnât update.đ
1 Answer
0
Will u send the code