Articles → JavaScript → Enums In JavaScript

Enums In JavaScript






Purpose





Syntax


  var  variable_name = {enumerator_1:value, enumerator_2:value….}



Example


<script>
    var contentType = { Articles: "Articles", InterviewQuestions: "Interview Questions" };
    console.log(contentType.InterviewQuestions);
</script>

Try It


Output


Picture showing the output of enums in javascript



Posted By  -  Karan Gupta
 
Posted On  -  Monday, August 15, 2011

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250