I want to run a javascript file in the browser, for that, I created an index.html file
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>javascript</title>
<script src="recamans.js" type="text/javascript">
</script>
</head>
<body>
</body>
</html>
and linked my javascript file as shown above. The javascript file which I included is
let count = 1;
let sequence = [];
let numbers = [];
let index = 0;
let next;
function step() {
let next = index - count;
if( next < 0 || numbers[next]){
next = index + count;
}
numbers[next] = true;
sequence.push(next);
index = next;
count++;
}
function setup() {
let createCanvas = (600, 400);
numbers[next] = true;
sequence.push(index);
for( let i=0; i<10; i++){
step();
}
console.log(sequence);
}
setup();
but it is not producing any outputs in the browser.
Aucun commentaire:
Enregistrer un commentaire