Home > Blockchain >  Getting JS syntax errors on online ide but not on vsc or node
Getting JS syntax errors on online ide but not on vsc or node

Time:06-11

I've got the following code

class Test {
  name = 'David';
  static var1 = 'John';
  printName() {
    console.log(this.name);
  }
  static staticMethod() {
    console.log('This is a static method');
  }
}
const test = new Test();
test.printName();
Test.staticMethod();
console.log(Test.var1);

It works fine on VSC with live server and also when running it on node, but I get syntax errors when running it on online IDEs such as jsfiddle or programiz. I was wondering if anybody knows why that is?

CodePudding user response:

Turns out it's a known bug in jsfiddle. I guess other online ides must use the same parsing library.

https://github.com/jsfiddle/jsfiddle-issues/issues/1744

No idea why someone would down-vote the question though. I'm guessing it's the same reason he or she down-voted the other four or five questions after mine in a row.

  • Related