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
  • 12,292
  • 8
  • 41
  • 69
  • `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
  • 143,282
  • 16
  • 168
  • 197