Loading
Current section: 1. Expressions And Output 7 exercises
solution

Strings

Transcript

00:00 Alright. So let's go console dot log hello and then a plus and then an empty space and then a plus and then TypeScript. Save that. The formatter is not actually going to adjust this because, this that would actually change behavior. So formatters shouldn't change this because that that would be wrong.

00:20 Okay. And then for some reason, the AI thinks I'm Kevin O'Connor. I think it's because I use Kevin O'Connor as an example for escaping. I am Kent C Dodds. Yes.

00:30 And we're gonna let's go ahead and add another quote there too. There we go. Tada. Something like that. K.

00:36 And then let's, concatenate a sentence. I am learning to code. And you've got pluses all over the place. This is one situation where you're like, I'm so glad that the AI wrote that code for me. I didn't wanna have to write all those pluses.

00:48 Super annoying. And like I said earlier, we do have better ways of doing this too, but you are gonna see code like this and it is important for you to understand how concatenation of strings works. So save that. I am learning to code. It's it looks wonderful.

01:01 You can also, of course, run node on index TS. There we go. And it all looks, as you would expect in there as well. So there you go. That's string concatenation.

01:11 It's just a little plus sign. And I should mention also that the the spaces in here, outside of the string, they don't matter. That's all gonna be the same and so your formatter will actually change that. Spaces inside of the string though, that does matter. So if you have a bunch of spaces in here, then you're gonna actually have a bunch of space in here.

01:29 I'll fix the rendering of that so it shows that. But if you run, index here, you'll see we have all those spaces right there. So the spaces inside, they do matter. Spaces outside do not. Alright.

01:42 There you go. That is string concatenation.