I have two sets of code here that are getting the same error. When I run the code, there is an unexpected token/syntax error “)” but I don’t see where I’m missing a parentheses. Is my program glitching or does anyone else see my error?
— CODE 1 —
The instructions were to:
Iterate through the array and multiply a number by 10 if it is greater than or equal to 5.
const timesTenIfOverFive = [23, 9, 11, 2, 10, 6];
for (i = 0; i < timesTenIfOverFive; i++) {
if (timesTenIfOverFive[i] >= 5 ===) {
timesTenIfOverFive[i] *= 10;
}
}
console.log(timesTenIfOverFive);
The instructions were to:
Iterate through the array and multiply a number by 10 if it is greater than or equal to 5.
The results should run: 230, 90, 110, 2, 100, 60
— CODE 2 —
instructions: You are provided with an object called checkObj
. Using a for... in
loop, determine if the object contains the property foundNum
. If it exists, reassign the value of found
to 1.
const myNums = [50, 75, 90]
for (let i = 0; i < myNums.length; i++) {
const num1 = myNums[i];
for (let j = 0; j < myNums.length; i++) {
const num2 = myNums[j];
console.log('sum:', num1, num2);
}
}