SOURCE

var q=0,w=2,e=3;
if(q<2)
    document.write("true");
document.write('<br/>-------------------------------<br/>');
//双向选择
if(q<1)
    document.write("true");
else
    document.write("false");
document.write('<br/>-------------------------------<br/>');
//多项选择
var time=1;
if(time<12)
{
    document.write("早上好!");
}
else if (time>=12&&time<18)
{
    document.write("下午好!");
}
else
{
    document.write("晚上好!");
}
document.write('<br/>-------------------------------<br/>');
//if语句的嵌套
var x=4;
var y=8;
if(x<5)
{
    if(y<5)
        document.write("x小于5,y小于5");
    else
        document.write("x小于5,y大于5");
}
else{
    if(y>5)
        document.write("x大于5,y小于5");
    else
        document.write("x大于5,y大于5");
}

document.write('<br/>-------------------------------<br/>');
function isInteger(num){
    var result = false;
    if(parseInt(num)==parseFloat(num))
        result=true;
    return result;
}
if(isInteger(15)){
    document.write("15 is an integer."+"<br/>");
}

document.write('<br/>-------------------------------<br/>');
function findDaffodi(num){ 
    document.write("Print daffiodil number: "+"</br>");
    for(var num=100;num<1000;num++){
        var unitsDigit = num %10;
        var tensDigit = parseInt((num/10)%10);
        var hundredsDigit = parseInt(num/100);
        var a=unitsDigit*unitsDigit*unitsDigit;
        var b=tensDigit*tensDigit*tensDigit;
        var c=hundredsDigit*hundredsDigit*hundredsDigit;
        if(num==(a+b+c))
        {
            document.write(num+"<br/>");
        }
    }
}
findDaffodi();
console 命令行工具 X clear

                    
>
console