Commit d54e5938 authored by Sumaiyya Burney's avatar Sumaiyya Burney

Initial commit

parents
<html>
<head>
<title>Basic HTML !!!</title>
<script type="text/javascript" src="jsPract.js"></script>
</head>
<body>
<h1>Hello, World!!</h1>
<script type="text/javascript">funct()</script>
<form>
<input id="textIn">
<button id="submit" onclick="writeUserIn()">ok</button>
</form>
<form>
<input id="numIn" type="number">
<button id="numBut" onclick="primeNums()">Generate prime numbers</button>
</form>
</body>
</html>
\ No newline at end of file
// Variables - Scopes DONE
// Functions DONE
// Operators DONE
// Conditional statements DONE
// Loops DONE
function funct(){
document.write("pls write");
}
function writeUserIn(){
var userIn = document.getElementById("textIn").value;
alert(userIn)
}
//global var
const primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97];
function primeNums(){
var numIn = document.getElementById("numIn").value;
for (i = 0; i < (Math.min(numIn, 100)); i++){
if (primes.includes(i)){
document.write(i + '\n');
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment