 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to use case-insensitive switch-case in JavaScript?
To use case-insensitive switch-case in JavaScript, make the input all upper or all lowercase.
Example
You can try to run the following code to learn how to use a case-insensitive switch:
<!DOCTYPE html> <html>    <body>       <h3>JavaScript Strings</h3>       <p id="test"></p>       <script>          var str = "amit";          str = str.toUpperCase();          switch (str) {             case 'AMIT': document.write("The name is AMIT <br>");             break;             case 'JOHN': document.write("The name is JOHN <br>");             break;             default: document.write("Unknown name<br>")          }          document.write("Exiting switch block");       </script>    </body> </html> Advertisements
 