Automatic Conversion of JavaScript Variables and Sentences

  • 2021-06-28 10:22:28
  • OfStack

JS Automatic Type Conversion

var a = 1;
var b = true;

"==" means that automatic type conversion is possible and the values are compared
"===" means that you can automatically type-convert by comparing values before types

if (a == b) {
alert ("equal"); //Print
}else{
alert (unequal);
}

3-item operation

var c = 10/2 > 4 ? 5 : 3 ;
alert(c);

About for Cycle

for ( var i = 0; i < 5; i++) {
alert (i);
}

Dead cycle

for(;;){
alert (Executor);
}


Related articles: