Hello, World Program using JavaScript.

JS

Program to display Hello World one hundred times using JavaScript.

NOTE: This requires basic JavaScript and DOM manipulation.

Code:


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PoorWebDev</title>
</head>
<body>
<script>
for(var i=0;i<100;i++){
document.write(i + 1 + ": " + "<span>Hello, World!<span><br>");
}
</script>
</body>
</html>

Simple Example For Hello World Output two times: 

Code:


<button onclick="myfun()">click me</button>
<script>
function myfun(){
for(var i=0;i<2;i++){
alert(i + 1 + ": " + "Hello, World!");
}
}
</script>

Tags: No tags

Add a Comment

Your email address will not be published. Required fields are marked *