জাভাস্ক্রিপ্ট বাক্সের বাইরে Enums সমর্থন করে না। জাভাস্ক্রিপ্টে enums থাকার একমাত্র উপায় হল অবজেক্ট ব্যবহার করে তাদের বাস্তবায়ন করা।
নিম্নলিখিত কোডটি জাভাস্ক্রিপ্ট -
-এ গণনাকৃত প্রকার দেখাচ্ছেউদাহরণ
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
body {
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
.result {
font-size: 18px;
font-weight: 500;
color: rebeccapurple;
}
</style>
</head>
<body>
<h1>Enumerated Types in JavaScript</h1>
<div class="result"></div>
<button class="Btn">CLICK HERE</button>
<h3>Click on the above button to get the color values</h3>
<script>
let resEle = document.querySelector(".result");
let color = {
orange: 1,
red: 2,
green: 3,
blue: 4,
pink: 5,
};
document.querySelector(".Btn").addEventListener("click", () => {
resEle.innerHTML += "color.orange = " + color.orange + "<br>";
resEle.innerHTML += "color.red = " + color.red + "<br>";
resEle.innerHTML += "color.green = " + color.green + "<br>";
resEle.innerHTML += "color.blue = " + color.blue + "<br>";
resEle.innerHTML += "color.pink = " + color.pink + "<br>";
});
</script>
</body>
</html> আউটপুট
উপরের কোডটি নিম্নলিখিত আউটপুট −
তৈরি করবে 
'এখানে ক্লিক করুন' বোতামে ক্লিক করলে -
