You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
123456789101112131415161718192021 |
- /* declaratie variablen */
- 'use strict'
-
- /* function */
-
- function sumToN(n) {
- let sum = 0;
- let count = 0;
- while (true) {
- if (count > n) {
- return sum;
- }
- sum += count;
- count++;
- }
- }
-
-
- /* output */
- let result = sumToN(10)
- console.log(result);
|