Enable contrast version

# Tutor profile: Gray O.

Inactive
Gray O.
Math, Science, Computer and Art Geek and Tutor
Tutor Satisfaction Guarantee

## Questions

### Subject:Javascript Programming

TutorMe
Question:

Consider the following code: $(\texttt{ (function() { var a = b = 10; })(); console.log(a); console.log(b); }$) What will be output to the console?

Inactive
Gray O.

The first thing we notice in this question is that we have a function literal that is being called immediately and then two $${\tt console.log}$$ statements that output the value of variables $$a$$ and $$b$$. The important thing to understand here is that the IIFE will interpret the line $${\tt var a = b = 10;}$$ as two separate assignments. The first will assign a local variable $$a$$, to the value of $$b$$. However, in order to get the value of $$b$$, it must first assign $$b$$ to be a global variable with the value 10. $$b$$ is a global variable because it does not have the keyword $${\tt var}$$ in front of it. Therefore, the console will output $(\texttt{ undefined 10 })$ $$a$$ is a local variable to the function literal, so it will not be defined in the global scope. $$b$$, on the other hand, is declared as a global variable, and so its value will still be 10 outside of the function.

### Subject:Trigonometry

TutorMe
Question:

Two airplanes take off at the same time from the same airport. One is traveling at 350mph and the other is traveling at 575mph. How far apart are they from each other after 1 hour and 40 minutes if there is an angle of 30 degrees between their directions of flight?

Inactive
Gray O.

## Contact tutor

Send a message explaining your
needs and Gray will reply soon.
Contact Gray