This week I've learned

BrandonPerry
2 min readJan 17, 2021

--

“Describe one thing you’re learning in class today?”

One thing I’m learning in class is how to write out For loops in JavaScript. At the initial sight, I thought it would be challenging to get the syntax, but it wasn’t that bad once I started practicing and writing them out. The for-loop takes three expressions that are separated by semicolons enclosed within parentheses.

“What’s the difference between: function Person(){}, var person = Person(), and var person = new Person()?”

The only difference between the three declarations above is the first one creates a function with the name Person. In the second one, a variable has been defined and contains a reference to a Person function. The last one creates a new object of the Person class constructor by adding new before Person.

“What’s the difference between an “attribute” and a “property”?”

Attributes can be defined by HTML and can change like that of a variable. In comparison, properties are defined by the document object model and are not easily changeable and remain constant.

“What language constructions do you use for iterating over object properties and array items?”

When it comes to iterating over object properties and array items, you would mainly use a for loop, mainly the for-in loop, because it will iterate over inherited properties.

“What is the event loop?”

The event loop is a continually running process that monitors both the callback queue and the call stack. If the call stack is not empty, the event loop waits until it is open and places the next function from the callback queue to the call stack

“What is the difference between the call stack and task queue?”

A call stack is where all your JavaScript code gets pushed and completed one at a time. Once the code is executed, it is taken out of the queue. The task queue is a runtime messaging queue that handles the task allocated by different APIs.

“What are the differences between ES6 classes and ES5 function constructors?”

ES6 classes do the work of defining a new object and are known as the syntax base for constructor functions. The ES5 function constructor looks the same but focuses on how the objects are instantiated.

--

--