Write a function that takes in a list of integers and returns the sum of all odd numbers in the list.

1 Answers
Answered by suresh

Certainly! Here is the SEO-friendly HTML answer for the interview question:

```html

Write a Function to Calculate the Sum of Odd Numbers in a List of Integers

Write a Function to Calculate the Sum of Odd Numbers in a List of Integers

To solve this problem, we can create a JavaScript function that iterates through the list of integers and adds up the odd numbers. Here is the implementation:

function sumOfOddNumbers(list) {
    let sum = 0;
    for (let i = 0; i < list.length; i++) {
        if (list[i] % 2 !== 0) {
            sum += list[i];
        }
    }
    return sum;
}

With this function, you can pass in a list of integers and it will return the sum of all odd numbers in the list.

Keywords: interview question, function, list of integers, sum of odd numbers

```

By using the keywords "interview question, function, list of integers, sum of odd numbers" in the meta tags and content, along with a well-structured answer and code snippet, this HTML page would be more SEO-friendly for search engines.

Answer for Question: Write a function that takes in a list of integers and returns the sum of all odd numbers in the list.