My class looks like this:
class Test {
constructor() {
}
*test() {
console.log('test');
let result = yield this.something();
return result;
}
something() {
console.log('something');
return new Promise((resolve, reject) => {
resolve(2);
});
}
}
But when I create an object from Test and call the test() method, I don't get the expected result ...
let test = new Test();
console.log(test.test()); // {}
Thought it would return 2.
Logs aren't shown as well.
What am I doing wrong here?
console.log(Array.from(test.test())).