When I load a script as simple as:
class ClassName {
constructor() {
this.x = 3;
}
}
into a web page as text/paperscript
, the web console returns
SyntaxError: Unexpected token (1:6)
If I switch to text/javascript
everything runs as intended, meaning there's no syntax error. Ah, and of course I've linked the paper.js
library in the HTML source.
Why JavaScript classes don't work in paperscript? Isn't paperscript just an extension of JavaScript?