Skip to main content
InterviewHubPRO
Section Overview
Q283

Question 283 of 536

Part 5: ES6+ Modern Syntax, Classes, Modules & Destructuring (254 - 328)

53%
JavaScript & V8 Internals (536 Qs)•Part 5: ES6+ Modern Syntax, Classes, Modules & Destructuring (254 - 328)

Are enums available in javascript

mid LevelCode ExampleTypeScript

No, javascript does not natively support enums. But there are different kinds of solutions to simulate them even though they may not provide exact equivalents. For example, you can use freeze or seal on object,

javascript
  var DaysEnum = Object.freeze({"monday":1, "tuesday":2, "wednesday":3, ...})