---
# System prepended metadata

title: Q .What letters will this loop log out to the console?

---

# Q .What letters will this loop log out to the console?

var arr = ['a', 'b', 'c', 'd', 'e', 'f'];
for (var i = 0; i < arr.length; i++) {
  console.log(arr[i]);
  arr.splice(i + 1, 1);
}
Be careful!

Answer
a c e


# Write a function called sumArr that takes in an array as an argument, and returns the sum of all the numbers in the array. The array can either contain numbers, or strings of numbers;

For example:

sumArray([1, 2, 3, 4, 5]); //returns 15
sumArray([10, '5', '10', 5]); //returns 30

# What is the DOM? How is it different than jQuery?

Answer
DOM stands for Document Object Model, which is basically an interface for interacting with webpages using JavaScript. The DOM provides a structured representation of the webpage which we can then access using built in methods and properties to do things like page and style manipulation.

jQuery is a library that's built on top of the DOM, that makes it easier to manipulate web pages.


