I'm playing a bit with async/await of Node 8.3.0 and I have some issue with static function.
MyClass.js
class MyClass {
static async getSmthg() {
return true;
}
}
module.exports = MyClass
index.js
try {
const result = await MyClass.getSmthg();
} catch(e) {}
With this code I've got an SyntaxError: Unexpected token on MyClass.
Why is that? Can't use a static function with await or have I made a mistake?
Thank you
awaitinsideasyncfunction. Do you wrap the code fromindex.jswith a function?asyncfunction. Thank you all