Check out a free preview of the full The Hard Parts of Asynchronous JavaScript course:
The "Promises Q&A" Lesson is part of the full, The Hard Parts of Asynchronous JavaScript course featured in this preview video. Here's what you'd learn in this lesson:

Will answers questions from students about event loops role with Promises, promises and allocated memory, the ability to add or modify const, and more.

Get Unlimited Access Now

Transcript from the "Promises Q&A" Lesson

>> Will Sentance: All right, let's all thumb on this cause again, it's going to be a bunch of edge cases. What happens if x happens, what happens if y happens? Everyone's thumbs out, you lost me? I'm clear? I have clarification. Everybody's thumbs out. Alex has clarification, Ben's clear, Blessing's clear.

>> Will Sentance: Sean has a clarification. Mike has one. Brian's clear. Let's come to Alex.
>> Alec: Alec.
>> Will Sentance: To Alec apostrophe s.
>> Alec: Yeah.
>> Will Sentance: That's why I was saying Alex.
>> Alec: There we go yep.
>> Will Sentance: That's literally why I was saying. As I said it I thought, that's interesting, if you speak in the possessive sense for someone like Alec it's ambiguous.

[00:00:39] Let's come to Alec's question.
>> Alec: Maybe we were gonna get to this but I guess I was just wondering if it's going to use the event loop like.
>> Will Sentance: Absolutely, it is, but in a really interesting way, Shawn.
>> Sean: So my question was, if the web browser feature directly sets the memory, or if it uses the event loop?

>> Will Sentance: That's a very good question.
>> Will Sentance: It certainly gives precedence of setting that, more interesting is gonna be, when does the function get triggered so let's hold that question for now. Mike?
>> Mike: I was just wondering if future data represents the promise object that's getting value updated, why do we use a const?

>> Will Sentance: Because okay, so you're asking about const, and whether allow. So object, so the only thing about const. Const says, so const should be your default way of storing data in JavaScript now. But for values, all right, for primitive values, that means numbers, strings, true faults, bullions. If you wanna change there value at any way at all, you're changing the position in memory so you're not allowed to do so.

[00:01:43] But objects and arrays, as long as you don't literally throw out the entire object and replace it with a brand new one and just add properties to it or add positions to an array, elements in array, that's well within the rights of conts. Conts only says do not throw me out completely, my data, and replace with a brand new thing in memory.

[00:02:01] You're perfectly allowed to add new properties to it, update the values of properties, add new elements to an array.. Does that make sense? And that's why we all default to const now for everything, unless it's a primitive value where you know you wanna change it from three to four, in which case, that's not allowed.

[00:02:16] Or if you know you wanna switch an object completely out in memory, and say, thank you for that object, here's a brand new one, then you would use that. But I don't know when you'd do that particularly, but you might. So it's pretty much default to const now.

[00:02:27] And that's a helpful way of making sure reassignments don't happen unintentionally. Good side question. Okay, further thumbs that were medium? Ben was clear, who else was medium thumb? Yes,
>> Will Sentance: Rick.
>> Rick: Very good, all right. So when the future data's value is set, and it caused the on fulfillment function.

>> Will Sentance: Let's say it triggers the on fulfillment.
>> Rick: Okay, so that-
>> Will Sentance: So we're gonna see in a moment, there's definitely some intermediate steps before it gets called.
>> Rick: So when it gets triggered, is that in JavaScript, or is that part of the web browser feature?
>> Will Sentance: It's in JavaScript and that's perhaps why we're gonna discover JavaScript handles how it gets triggered, and therefore called in a slightly different way.

[00:03:18] You've teemed something up nicely there, Rick, so let's see.