# Looping Logic

What is the output of the following code?

```javascript
let answer = 0;

for(let i = 0; i < 10; i++) {
    answer += i;
}

console.log(answer);
```

## 45

Level: Apprentice · [More JavaScript terms at this level](https://www.ask-codey.com/glossary/subjects/javascript/apprentice)

Updated: September 27, 2026

Source: https://www.ask-codey.com/glossary/looping-logic
