#What is the error-prone knowledge about JS?
The difference between == and ===:
==: Determine the difference between two variables Whether the values are equal.
===: Determine whether the types and values of two variables are equal. When both conditions are met at the same time, the expression is True.
The role of break in switch:
For example: when case 2 that satisfies the conditions, there is no break below , case 3 will also be executed
If the statement after a case does not write break, then the program will execute downwards without exiting;
1 var num = 2; 2 switch(num){ 3 case 1: 4 alert('case 1'); 5 break; 6 case 2: 7 alert('case 2'); 8 case 3: 9 alert('case 3');10 break;11 default:12 alert('default');13 break;14 }
The above is the detailed content of What is the error-prone knowledge about JS?. For more information, please follow other related articles on the PHP Chinese website!