This is my first time using VSC, so I am new to VSC, and this is the first time I am using it. I am using a tutorial and when I run my program (on Windows Script Host) , it gives me a error even though the code is not wrong. The error I got is:
Script: E:\code.projects\JSTUT.js
Line: 4
Char: 9
Error: Expected ‘;’
Code: 800A03EC
Source: Microsoft JScript compilation error
JSTUT.js
// Pi = 4/1 - 4/3 + 4/5 - 4/7...
function calcPI(iterations){
let pi = 0, divisor = 1;
for(i = 0; i <= iterations; i++){
pi = pi + (4/divisor) - (4/
(divisor + 2));
divisor += 4;
}
fibList.shift();
document.getElementById("output1")
.value = pi.toFixed(10);
}
let fibLib = [];
function getFibList(howMany){
for(i = 0; i < howMany; i++){
fibList[i] = fib(i);
}
document.getElementById("output1")
.value = fibList.join(", ");
}
function fib(whichNum){
let num1 = 1, num2 = 0, temp,
i = 0;
while(i < whichNum){
temp = num1;
num1 = num1 + num2;
num2 = temp;
i++;
}
return num2;
}
Video:
https://www.youtube.com/watch?v=IyDVvGmzTlo&list=PLhEpn9gptQtEjUJOCmVnUx0pB0VquVvnu&index=16&t=0s
Let me know if I should give more information.
Thanks in advance, and have a great day!