loading...

re: MVC Calculator in "almost" Vanilla JS VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Hi there. You said in your first example that this was how to make an enumeration in JavaScript: const Color = { RED = 0, GREEN = 1, BL...
 

Yes, you are right. That is what you get, after using TS too much :).

I would even go as far to tell the best way would be something like this:

const COLOR = Object.freeze({
  RED: 1,
  GREEN: 2,
  BLUE: 3
});

Thanks.

 

Haha, I knew that! Yes I though about adding the Object.freeze, but I didn't know whether you wanted to go this far or not. But it's great that you added a fully capable example.

Great article. Keep up the good work!

code of conduct - report abuse