0

Is it possible to make a variable "a" into a new class "simple". Then make a into a function so I can call a like 'a("hey")'? And if so how? Thanks!

class simple {
    /*
    function(c) {
        console.log(c);
    }
    */
}

let a = new simple();
let b = a('hey');
JoeTheHobo
  • 137
  • 10
  • 3
    Sounds like [an XY problem](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem). Can you explain what you're trying to solve with this? – VLAZ Nov 25 '19 at 18:26
  • Agreed with VLAZ here, seems like either creating a function that you can call, or a method on a class would be the right solution. Why does your class instance need to be a callable function itself? – mhodges Nov 25 '19 at 18:27
  • I don't really have a thing I'm trying to solve with this, I'm just trying to understand JavaScript in every way, and this came to my mind so I was just wondering. – JoeTheHobo Nov 25 '19 at 18:35
  • It doesn't make sense to do it – epascarello Nov 25 '19 at 18:37

0 Answers0