function sayHello() { return () => { console.log("Hello!"); }; }function test() { return function x() { return "xxxxxxxx" } } console.log(test()) //[Function: x()] console.log(test()()) //xxxxxxxx function X() { return function x() { return "xxxxxxx" } } let q = new X(); console.log(q()); //returns "xxxxxxx" //to be able to create an instance of a function, make sure it returns a function and then q() gets the value that said function returns