0

I'm migrating some PrototypeJS code to pure JS / jQuery, and I'm encountering a problem. Actually, PrototypeJS allowed to create some classes like "MyClass.Methods"

Here is an exemple :

Form.Element.Observer = Class.create(Form.Element, {
    method1: *some code*
});

Form.Element.Observer is the name of the new class, Form.Element is the extended class.

Actually JavaScript gives me an error (Uncaught SyntaxError: Unexpected token '.') when I'm doing a class with the exact same name (with dots). I don't really know how to make that, did somebody can gives me some informations please ?

Many thanks in advance

Ferenc
  • 39
  • 7
  • You mean you want to use ES6 `class` syntax? It should be `Form.Element.Observer = class Observer extends Form.Element { … }` – Bergi Jul 30 '20 at 15:32
  • That's exactly what I means ! Thank you so much for this answer ! – Ferenc Jul 31 '20 at 07:06

0 Answers0