Does javacript not support classes?

I am looking for a piece of code, there is no problem running locally, uploading to the ubuntu server to run, browsing the page will find this kind of error in the console, saying that it is a syntax error. Excuse me, is there a problem with writing class in javascript code? The picture shows (7 br 18) which happens to be the position of the c letter of class. In fact, it was an error like this at first

.

clipboard.png

clipboard.png

clipboard.png


360IE11htmldjangodjangoscp

clipboard.png

Jul.20,2021

  1. this is the syntax of es6. Only browsers that support es6 can run it, otherwise a grammatical error will be reported.
  2. you can run locally because your 360 automatically turns on extreme speed mode.
  3. 360 is a hybrid, it is actually ie+chrome, and automatically switches between the two modes. I hate it so much that I didn't study it, and the switching rules are unknown.
  4. you can tell whether it is in extreme mode by whether there is a lightning icon on the right side of its address bar
  5. the so-called extreme speed mode is to switch the core from ie to chrome. Chrome supports es6 syntax, so it can run normally
  6. thought of the Red Core incident some time ago. Feel sad and angry at the incompetence and unlimited publicity of domestic browsers!

when introducing themselves, most domestic browsers avoid mentioning that the kernel they use is not developed by themselves, but is parked / stolen. They spend a lot of space or even all the space to introduce their own speed, accessibility, compatibility, but not to mention the kernel

however, these are nothing in front of Red Core, which has created a new lower limit for domestic browser companies, treating Chinese people as fools and the government as a cash cow. After being exposed, they shamelessly use the excuse of mental retardation to argue shamelessly. It is simply shameless!

Please automatically ignore the last item when reading.


class is the ES6 syntax and is only supported in modern browsers. Look at your screenshot, the browser you are using is IE (or the full range of domestic IE shell browsers), IE does not support ES6, if it is not compiled to ES5, it will not be executed correctly.

class support: https://caniuse.com/-sharpfeat=es6.


Code paste all.


specific error paste. You probably opened it in the ancient ubuntu browser. It's normal that the old browser does not support classes. Js syntax compatibility can be solved with babel


babel: to solve some incompatibility problems that let browsers parse ES6


you need a javascript compiler: Babel

Menu