What is the HTML code to display the first 20 odd numbers?
<!DOCTYPE html>
<html>
<head>
<title>20 Odd Numbers Smarter</title>
</head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
for (var num=0; num<40; num++){
if (num % 2 != 0){
$("#nums").append(String(num) + "<br>");
}
}
});
</script>
<body>
<p id="nums"></p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>20 Odd Numbers Smarter</title>
</head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
for (var num=0; num<40; num++){
if (num % 2 != 0){
$("#nums").append(String(num) + "<br>");
}
}
});
</script>
<body>
<p id="nums"></p>
</body>
</html>
No comments:
Post a Comment