Explain common code blocks in JavaScript switch statement?

Following is the code to implement common code blocks in JavaScript switch statement −


 Live Demo

<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
   body {
      font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
   .result {
      font-size: 20px;
      font-weight: 500;
<h1>JavaScript Switch statement</h1>
Enter day 1-7<input type="text" class="day" /><button class="Btn">
<div style="color: green;" class="result"></div>
Click on the above button to check which day it is
   let dayVal = document.querySelector(".day");
   let resEle = document.querySelector(".result");
   document.querySelector(".Btn").addEventListener("click", () => {
      switch (parseInt(dayVal.value)) {
      case 1:
         resEle.innerHTML = "It's monday";
      case 2:
         resEle.innerHTML = "It's tuesday";
      case 3:
         resEle.innerHTML = "It's wednesday";
      case 4:
         resEle.innerHTML = "It's thursday";
      case 5:
         resEle.innerHTML = "It's friday";
      case 6:
         resEle.innerHTML = "It's saturday";
      case 7:
         resEle.innerHTML = "It's sunday";
         resEle.innerHTML = "Enter a value between 1 - 7";


The above code will produce the following output −

On entering a number between 1-7 and clicking on CHECK −