- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Is it safe to assume strict comparison in a JavaScript switch statement?
To get out of the confusion regarding strict comparison, try to run the following code snippet in JavaScript −
Example
switch(1) { case '1': alert('Switch comparison: Not Strict.'); break; case 1: alert('Switch comparison: Strict.'); break; default: alert(‘Default’); }
- Related Articles
- Explain Strict Comparison in JavaScript switch statement?
- What is Switch...case statement in JavaScript?
- What is Strict Mode in JavaScript and How to Enable It?
- Can we have a return statement in a JavaScript switch statement?
- What is a switch case statement in Java and how to use it?
- What is MySQL NULL-safe equal operator and how it is different from comparison operator?
- Is it a good practice to end switch with defaults in JavaScript?
- Explain common code blocks in JavaScript switch statement?
- What is Strict mode in JavaScript?
- Switch Statement in Java
- What does “use strict” do in JavaScript, and what is the reasoning behind it?
- What is the difference between "strict" and "non-strict" modes of JavaScript?
- Java switch statement
- PHP switch Statement
- How to write a switch statement in a JSP page?

Advertisements