Back to the wonderful world of Dinh’s teaching.

Heather Barr
5 min readMar 9, 2019

Well, hello again! Oh, how I’ve missed you and your teaching ways! To be honest, transferring into this class I was NOT excited to have these blog assignments… but now that I’ve started to write my first one, I think I’m going to really enjoy them. It’s also nice knowing that I will always have a log of how I felt during my journey with Austin Coding Academy, when I want to reflect.

So basically how it works is, every week I am given a set of questions to answer here in Medium. So let’s do it!

Describe one thing you’re learning in class today.

I am a little caught up on the material in class from my transfer, I believe. However, there definitely are some things I believe I’ll learn as a result of differences in the classes themselves. Today was day one for me, so I knew a bit of what we discussed, however I loved the review of working with objects and .this. I feel it was important for me to touch on that subject again, as I wasn’t feeling 100% confident in what we discussed, and answered some class questions wrong. That makes me believe I made the right decision in my move.

Difference between: function Person(){}, var person = Person(), and var person = new Person()?

function Person () {}

This is an actual function, which does nothing at all. As you see above, once we console.log this statement, the return is [Function: Person]

var person = Person ()

This is a variable called person, which is pointing to the function of Person and calling that function. The function of Person is being returned in the console as Person {}. The function isn’t doing anything here.

var person = new Person()

This is another variable called person, however this is a bit different as it’s creating a new object from Person, the object/function. It acts as a copy, in my opinion. We could’ve also done something like, let heather = new Person (). This way you can make different people containing the same properties that can all have different values. Examples being: age, name, height, weight, etc...

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

So, before I browse the web on this question, I’ll just say what I already know. That being properties are super important and awesome when working with objects in JavaScript. For example, let’s say I have an object called person and inside that are some “properties” people have.

Now I can access these different areas inside my person object or even make new people and change the values of properties per new person!

Attribute: specified in HTML, always in the form of string

Property: specified in DOM object, can have any type of JavaScript

Not gonna lie… I had to use Google’s help on the attribute part.

Mostly because I can’t really remember using them too much in my projects, lately. Only when trying to access elements inside my HTML. Now, after browsing, I don’t have too much else to say about attributes other than they’re used to access elements inside your HTML. I feel they’re similar in use, referring to the way you literally code them, but just reaching out to different things in your project. If you’re working on your GUI, then yeah you’ll definitely be using attributes (But…probably using properties, also, for the values and information stored).

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

Besides the traditional for/ for…in/ or do…while loops

Some of my favs to iterate through an array are …

Array.prototype.every()

Array.prototype.filter()

Array.prototype.find()

Array.prototype.forEach()

Array.prototype.map()

Array.prototype.reduce()

Array.prototype.some()

Some of my favs to iterate through an object are …

Object.keys()

Object.entries()

Object.values()

What is the event loop?

The event loop looks at the stack and the task queue, pushing the first thing on the queue to the stack, when it sees the stack empty.

The event loop watches for events such as: setTimeout(callback, ms), setInterval(callback, ms), and setImmediate(callback). Once triggered the event + callback will be executed then removed from the list of events to execute. When there aren’t any events to run, the event loop is no longer going to return anything.

A really good article I found on this topic is linked below. Saravanan A R, you did a great job at explaining and breaking this down for all of us! Props to you, and thank you for the help!

What is the difference between call stack and task queue?

The easiest way I can think to break this down is…

Stack: When we call a function to execute, we’re pushing it on to the stack, and when we return from/break out of a function, we’re popping off the top of the stack.

Queue: Where all functions TO BE ran are held until it’s time to be executed. Some are immediate, some are set on timers, etc…

What are the differences between ES6 class and ES5 function constructors?

They’re basically the same thing, I think? I do know that there are no true “classes” in javascript. The class in ES6 is just a function constructor that looks like a class, by saying class before the function. My opinion about classes in JavaScript is that they’re pretty easy to work with and they’re easy to read. You’ll see an example of a ES5 function constructor and an ES6 class below, notice the similarities and differences! 😁

ES5

var Foo = function (arg1, arg2) {
this.arg1 = arg1;
this.arg2 = arg2;
};
Foo.prototype.calc = function () {
return this.arg1 + '+' + this.arg2 + '=' + (this.arg1 + this.arg2);
};
var num = new Foo (5, 5);
console.log (num.calc ()); // 5 + 5= 10

ES6

class Foo {
constructor (arg1, arg2) {
this.arg1 = arg1;
this.arg2 = arg2;
}
calc () {
return this.arg1 + '+' + this.arg2 + '=' + (this.arg1 + this.arg2);
}
}
var num = new Foo(5, 5);
console.log (num.calc ()); // 5 + 5 = 1

--

--