‫In the last video, we were able to write out some code to fetch a single to do and printed out at the
‫terminal.
‫Now everything works pretty well, but this console log right here is kind of ugly and it's hard to
‫understand in this kind of object format.
‫So in this video, I want to pull off the ID title and completed flags and print them out in a nicer
‫format, kind of like a little report of sorts.
‫So let's try making some changes to our code base.
‫I'm going to look back over to my editor and to get started, I'm going to first get a direct reference
‫to the to do, which is that data property right there.
‫So I'm going to essentially pull off that data property and assign it to a separate variable again,
‫just to make it easier to work with.
‫So I'll say const to do is response data.
‫So now we've got that to do.
‫We can pull off the ID, the title and completed properties, assign them to some temporary variables
‫and then we can insert them all into a single string and console log that string to essentially put
‫together our report.
‫So I'm going to pull off those three properties we just took a look at, so I'll say const ID is to
‫do dot ID.
‫I'll get title as to do that title.
‫And I'll say finished.
‫Is to do dot finished like so.
‫Now, if you're looking at these three lines of code and thinking, hey, Stephen, you just missed
‫something up right here, that's totally fine, just bear with me for a second.
‫If you're looking at this code and you don't see anything wrong, that's totally fine as well.
‫Again, just bear with me for a moment.
‫So now underneath that, we can start to print out a nice little report here.
‫So I'll do a console log.
‫To print out this as a nice little report, I want to use a multi-line string that is capable of using
‫string templating, so I want to kind of inject some variables into the string to do so.
‫We can use a template string, just as you might be familiar with from 2015.
‫So inside, if you are going to put a set of tactics.
‫Remember, these are tactics.
‫It's the character to the left of the one on your keyboard.
‫They are not single quotes.
‫I'm going to turn this into a multiline string.
‫And I'll say something like the to do with I.D..
‫Colin and I'll print out the ID.
‫Analogies like print out the title underneath, I'll say, as a title of.
‫Dollar sign title.
‫And I'll point out whether or not it is finished, so I'll say something like, is it finished?
‫And I'll print in the finished variable like so.
‫All right, so that's a little bit nicer to read report right there than the plane console log that
‫we had before.
‫So let's save this file and then attempt to run it at our terminal.
‫So I'm going to flip back over to my terminal and I'll run the file in one step using T.S.A. once again.
‫So I'll say T.S.A. index dot.
‫Yes.
‫Remember, we are feeding in the typescript file here.
‫We're not making use of the plane JavaScript file anymore.
‫So I'll run this command.
‫And sure enough, I end up seeing undefined, undefined, undefined, what's up with that?
‫That's kind of unexpected.
‫We just saw all that didn't appear correctly a moment ago when we did the console log.
‫So that means that we must have made a mistake somewhere in here.
‫So what is going wrong?
‫Well, let's take a quick pause right here.
‫When we come back, the next video, we're going to make sure it's really clear what's wrong with this
‫program.
‫And we're going to start to discuss how we can easily use TypeScript to avoid making the error that
‫we just made inside of here.
‫So quick pause and I'll see you in just a minute.