2. CHECKING ASSIGNMENT/REVIEW
<html> <html>
<body> <body>
<script> <script>
var age1= 50 var age1= 50
var age2= 68 var age2= 68
var age= (age1<age2) var age= (age1==age2
&&age2==age1>
alert(“”+age+””);
alert(“”+age+””);
document.write(“”+age+””);
document.write(“”+age+””);
</script>
</script>
</body>
</body>
</html>
</html>
3. CHECKING ASSIGNMENT/REVIEW
<html>
<body>
<script>
var user1= prompt(“What is the first calculating device?
Abacus or Comptometer?”,””);
var answ1= “Abacus”
var con1= (user1==answ1)? “Congratulation”:”Try Again”;
confirm(“Are you sure with your answer? ”);
alert(“”+con1+”’);
document.write(“Correct Answer”+con1+””);
document.write(“Your answer” +user1+””);
</script>
</body>
</html>
4. Identify if correct or error.
Source code
If error ,find code/s or missing codes that will cause error.
1. var name= parseFloat(prompt(“Enter name of the item”,” “));
2. var price= parseFloat(prompt(“Enter the amount”,” “));
3. Alert(The “+name+” is sold “+price” pesos””);
4. Var 4thyear=prompt(“Enter the number of 4th year students
”,” “);
5. Document.write(“The “+Name+” is sold “+Price” pesos””);
5. var distance= parsefloat(prompt(“Enter distance”,”);
5. If error ,find code/s or missing codes that will cause
error.
7. var x= prompt(What is kbps stand for? “ ,””);
8. Var y= “kilobytes per seconds”
9. var z= (x==y) Correct: Wrong ;
10. Confirm(Are you sure);
11. msdocument.wrirte(The correct answer is “+z+”);
12. var x= parsefloatprompt(What number is less than
10? “,”)
6. DECLARING VARIABLES IN ONE STATEMENT and
USING LOGICAL OPERATOR (or)||
<html>
<body>
<script>
var x= prompt("Who created the JavaScript? "," ");
var y= "Brendan Eich", n= "brendan eich", m=
"Brendan"
var z= (x==y||x==n||x==m)?"Correct": "Wrong";
alert(""+z+"");
document.write("Correct Answer: "+y+"");
</script>