0

I have a javascript object menu, and I want to add a property controller which should be a constructor. However, the following gives a syntax error:

class menu.foobar {
    // stuff here
}

What is the right way to do this?

markasoftware
  • 11,507
  • 7
  • 39
  • 65
  • `const menu = { foobar: class { … } }`? It's the same as if you had a `function` declaration. – Bergi Aug 22 '16 at 21:19

1 Answers1

1

Use a class expression:

menu.foobar = class {}
Ram
  • 140,563
  • 16
  • 160
  • 190