console
var a = 100;
if (a > 10) {
document.write("1");
}
document.write('<br/>---------------<br/>');
var a = 100;
if (a < 10) {
document.write("1");}
else {
document.write("2");}
document.write('<br/>---------------<br/>');
var score = 480;
if (score < 400)
{
document.write("不读书");
}
else if (score >=400 && score < 500)
{
document.write("上二本");
}
else
{
document.write("上一本!");
}
document.write('<br/>---------------<br/>');
var a = 3;
var b = 10;
if (a < 5)
{
if (b < 5)
{
document.write("a<5,b<5");
}
else
{
document.write("a<5,b>5");
}
}
else
{
if (b < 5)
{
document.write("a>5,b<5");
}
else
{
document.write("a<5,b>5");
}
}
document.write('<br/>---------------<br/>');
function isInteger(num){
var result = false;
var num = 15;
if(parseInt(num) == parseFloat(num)){
result = true;
}
return result;
}
if (isInteger(15)){
document.write("15 is an integer.");
}
else{
document.write("15 isn't an integer.");
}
document.write('<br/>---------------<br/>');
function isInteger(num){
var result = false;
var num = 3.24;
if(parseInt(num) == parseFloat(num)){
result = true;
}
return result;
}
if (isInteger(3.24)){
document.write("3.24 is an integer.");
}
else{
document.write("3.24 is a decimals.");
}
document.write('<br/>---------------<br/>');
function printDaffodilNum() {
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);
if(num==(unitsDigit*unitsDigit*unitsDigit+tensDigit*tensDigit*tensDigit+hundredsDigit*hundredsDigit*hundredsDigit)){
document.write(num+"<br/>");
}
}
}
printDaffodilNum();
document.write('---------------<br/>');
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script>
</script>
</head>
<body>
</body>
</html>