mykeylynx
5/17/2018 - 9:10 PM

https://csx.codesmith.io/units/functions-execution-context/1

Challenge 8 You are given a variable countDown that is initialized to 10. Use a for loop to decrease it's value by 1 on every iteration of the loop until it's value is 0.

Challenge 9 You are given an array of 5 numbers called increaseByTwo. Use a for loop to iterate through the array and increase each number by two.

Challenge 10 Using increaseByTwo from Challenge 9, iterate through the modified array and multiply a number by 10 if it is greater than or equal to 5.

Challenge 11 You are given an empty array called fillMe. Using a for loop, fill the array with numbers from 0 to 10.

Challenge 12 You are given a new empty array called modifiedFillMe. Using a for loop, loop backwards through the fillMe array from Challenge 11 and populate the new array with the numbers if they are even.

Challenge 13 You are provided with an object called checkObj. Using a for... in loop, determine if the object contains the property foundNum. If it exists, log Found! to the console, otherwise log, Does not exist! to the console.

Challenge 14 You are provided with another empty array called objToArray. Using a for... in loop, fill the array with all of the numbers from the checkObj object from the previous challenge if they are greater than or equal to 2.

Challenge 15 Using a for loop, iterate through the objToArray to determine if any of the numbers are divisible by 6. If there are any, log true to the console. If there aren't any, log false to the console.

Challenge 16 You are provided with an empty array called nestedArr. Using a for loop, add 5 sub-arrays to nestedArr, with each nested array containing the string 'loop' concatenated with the corresponding index in nestedArr as it's first element, and just the index as it's second element. Example of a subarray - ['loop3', 3]

Challenge 17 Create a variable called loopNumbers and initialize it to an empty object literal. Using a for loop, iterate through nestedArr from the previous challenge. For each iteration of your loop, assign a new property to loopNumbers where the property name is the first element in each nested array in nestedArr and the value is the second element.

Challenge 18 Using a for...in loop, iterate through loopNumbers from the previous challenge and determine how many properties are contained within the object.

Challenge 19 You are given an array of integers called possibleIterable. Using an if statement, loop through the array and log each element to the console only if the number of elements in the array is greater than 3.

Challenge 20 You are given a variable called sumMe that is initialized to an object literal containing several key/value pairs, and a variable called total that is initialized to 0. Using a for... in loop, iterate through sumMe. If the value of the property that is being evaluated on the current iteration of the loop is a number, add it to total.


// Challenge 8
let countDown = 10;

// uncomment the below line to check your work
// console.log(countDown) // -> should print 0;

// Challenge 9
let increaseByTwo = [1, 2, 3, 4, 5];



// uncomment the below line to check your work
// console.log(increaseByTwo) // -> should print [3, 4, 5, 6, 7];

// Challenge 10

// uncomment the below line to check your work
// console.log(increaseByTwo) // -> should print [3, 4, 50, 60, 70];


// Challenge 11
let fillMe = [];


// uncomment the below line to check your work
// console.log(fillMe) // -> should print [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

// Challenge 12
let modifiedFillMe = [];

// uncomment the below line to check your work
// console.log(modifiedFillMe) // -> should print [10, 8, 6, 4, 2, 0]

// Challenge 13
let checkObj = {
  oddNum: 1,
  evenNum: 2,
  foundNum: 5,
  randomNum: 18
};

// Challenge 14
let objToArray = [];


// Challenge 15

// Challenge 16
let nestedArr = [];

// Challenge 17

// Challenge 18

// Challenge 19
let possibleIterable = [4, 3, 9, 6, 23];

// Challenge 20
let total = 0;
let sumMe = {
  hello: 'there',
  you: 8,
  are: 7,
  almost: '10',
  done: '!'
};