javascript single if

運用operator
condition && document.write("condition is true");

或使用if讓可讀較佳
if (condition) document.write("condition is true");

又或是用在變數
var myVariable = (condition) ? "condition is true" : "condition is false";

沒有留言: