console
var score=100;
if(score>60){
document.write("你通过测试");
}
document.write("<br/>-------------------<br/>");
var score = 59;
if (score < 60) {
document.write("补考");
} else {
document.write("你通过测试");
}
document.write("<br/>-------------------<br/>");
var time =14;
if (time < 12)
{
document.write("早上好!");
}
else if (time >=12 && time < 18)
{
document.write("下午好!");
}
else
{
document.write("晚上好!");
}
document.write("<br/>-------------------<br/>");
var gender = "女";
var height = 165;
if(gender=="男")
{
if(height>170)
{
document.write("高个子男生");
}
else
{
document.write("矮个子男生");
}
}
else
{
if (height > 170)
{
document.write("高个子女生");
}
else
{
document.write("矮个子女生");
}
}
document.write("<br/>-------------------<br/>");
function isInteger(num){
var result=false;
if(parseInt(num) == parseFloat(num)){
return true;
}
return result;
}
var num=15;
if(isInteger(num)){
document.write(num+" is an integer."+"<br/>");
}else{
document.write(num+" is not an integer."+"<br/>");
}
document.write("<br/>-------------------<br/>");
function isDecimal (num){
var result=false;
if(parseInt(num) != parseFloat(num)){
return true;
}
return result;
}
var num=15.5;
if(isDecimal(num)){
document.write(num+" is an decimal."+"<br/>");
}else{
document.write(num+" is not an decimal."+"<br/>");
}
document.write("<br/>-------------------<br/>");
function printDaffodiNum(){
document.write("print daffodil number:"+"<br/>");
for(var num=100;num<1000;num++){
var a=num%10;
var b=parseInt((num/10)%10);
var c=parseInt(num/100);
if (num == (a * a * a + b * b * b + c * c * c))
{
document.write(num+"<br/>")
}
}
}
printDaffodiNum();
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
</body>
</html>