# Tutor profile: Jace G.

## Questions

### Subject: Web Development

How does Firebase structure your databse?

Firebase structures your database by using a JSON object. Allowing for faster speed and easy to navigate information.

### Subject: Javascript Programming

var one = ['a', 'a', 'b', 'c', 'd'] var two = ['b', 'c' , 'd'] function test(one, two){ var three = {}; var last = []; var i = 0; for (i; i < one.length; i++){ three[one[i]] = true; } Object.keys(three).forEach(function(key) { one.push(key); }); for(var i in two) { if(one.indexOf(two[i]) === -1) last.push(two[i]); } for (i in one) { if(two.indexOf(one[i]) === -1) last.push(one[i]); } for (i in last){ if(last.indexOf(last[i] === i)) last.pop(i); } return last } var answer = test(one, two); If you were to console.log answer what would the console display?

When looking through the code, you start with two arrays, 'one' and 'two'. Then you have a function defined, 'test' that accepts two variables as inputs. After the function you have a variable, 'answer' that is set to the value of what the function test returns. As array ;one' and 'two' are passed to the function, they are manipulated in the following way. 1) An object named 'three' is created 2) An array named 'last' is created 3) A variable named i is created and set to 0 4) The object 'three' is populated with a for loop, where the values from array 'one' are used as the keys in the object. This creates an object with only 4 keys, since keys are unique, and you cannot have two keys with a value of 'a'. 5) Next there is a for loop that iterates through each of the 4 keys and appends them to array 'one' 6) Next there is a for loop that iterates through each item in array 'two' to check and see if that value is in array one. If it is in array 'two', and in array 'one', it is ignored, if it is only in array 'two' and not in array 'one' then it adds it to the previously created array 'last' 7) This does the same thing as number six except that it iterates through array 'one' first and checks the values against array 'two'. 8) The last for loop in the function iterates through the array 'last' and removes any items in the array that are the same value 9) the function then returns the array, 'last' The console would display ['a']

### Subject: Basic Math

Susan has flips a penny 3 times. What is the probability that she gets heads all 3 times?

1) This question is asking what the probability is that she will get a heads on the coin each time she flips it. 2) We know that a penny has 2 sides, so that means that there is a 50% chance she gets a heads on the first flip or a 1/2. 3) We also know that each time she flips a coin we will have a 50% chance of getting a heads or 1/2 4) since she flips the coin three times we will multiply those odds together so... =50% * 50% * 50% or =1/2 * 1/2 * 1/2 5) When we multiply those together we get the answer 12.5% or 1/8.

## Contact tutor

needs and Jace will reply soon.