Hello , I took a course to learn JavaScript so im in the syntax , control flow & basic functions so ive done this lecture and I think I got 99% of all infromation thats according that I was develop a little of Lua. there is an practices to just learn this basics and practice so I had an headche with 2 questions and I need help to explain this 2 question and why we write this
// Q1 . Create a for loop that iterates from 0 to 10, but only prints even numbers to the console.
let array_length = numbers.length
for (let i = 0; i < array_length; i++) {
let current_value = numbers[i]
let is_even = current_value % 2 === 0
if (is_even) {
console.log(current_value)
}
}```
`// Q2 . Given an array numbers, write a while loop that continues to sum the numbers until the sum is greater than 100, then exits the loop.`
```let array_numbers = [1, 2, 4, 5, 6, 10, 50, 70, 101]
let sum = 0
let i = 0
while (sum < 100) {
let current_value = array_numbers[i]
sum = sum + current_value
i++
console.log(sum)
}```