Skip to main content

over 3 years ago Syntax Podcast

Code Styles × Readable Rules and Petty Preferences

Wes Bos

Wes Bos Host

Scott Tolinski

Scott Tolinski Host

Topic 0 02:33

Function definitions vs arrow functions

Guest 1

inside of that.

Guest 1

If you're just defining, like, a top level function, not a method or ever, do you do what's called a named function? You write the word function and then the name of it, Open up parentheses, Function definitions How How you doing today, Scott? I'm doing good. Just hanging out, Q and a. Quality oh, you know? No. QA.

Guest 1

rid Function definition. There's many ways to define a function in JavaScript. Probably the 2 most popular ones are

Guest 1

open up curly brackets, or do you do, which is, rid. Generally, you try to side with more readable code over being a hotshot.

Guest 1

I am on team,

Topic 1 01:06

Scott launching a site this week

Guest 2

You're right. Yeah. Q and a. Buddy. Questions and answers. I know. I always say q and a. And then just as I was about to say that, I was like, wait a second. It might not actually be q and a.

Guest 2

launching our site

Guest 2

so many things pop up rid. After you're feeling like, alright. I'm ready to go. Yeah. And then your to do list has gotten down to, like, 4 more things left, and then now it's populated like rid Crazy again. So Totally. I I much prefer those like, a person that you've asked to do it than someone, like, being like, hey. Like, what's up with this rid Tweeting a screenshot

Guest 2

rid. Go through and find all these things, but, like, it's also super depressing to see

Topic 2 00:11

Discussing petty preferences and readable code

Guest 1

first, a petty preferences,

Guest 1

rid Good one for you. We kinda put 2 shows together. We had this idea of,

Guest 1

and as well as, like, why we prefer that,

Guest 1

over an arrow function in a variable, and there's some real reasoning behind that. So Scott and I are gonna go through a list of probably Twenty different things, and we're gonna say what we prefer

Guest 1

So we are sponsored by 3 awesome companies today, rid. Linode cloud computing developers trust

Guest 1

show, which is just things, tabs, and spaces and whatnot, and we'll talk about all of that. But then there's also, like, a lot of stuff which is like, I actually prefer over sticking in a variable. I've never felt good about that. What about you? Yeah. I'm pretty much the same way. However,

Topic 3 03:35

TypeScript makes arrow functions convenient

Guest 2

there has been a a recent kind of I will say that there I mean, I would maybe not pretty much the same way. I'm exactly the same way. However,

Guest 2

So in in TypeScript,

Guest 2

Much more easily

Guest 2

way. Even if you're not using an arrow function, if you're saying const do something is equal to Function do something. You can like, if you're assigning a function to a variable, thing that's popped up in my code base, which I wonder if you've noticed this.

Guest 2

as a type, this week. Rid Oh, wow. I'm just in Berserker mode here. Just you know? We we have a a friend of mine doing q and a for us. Is it q and a or QA?

Guest 2

using the const do something really great to just have somebody, We have a friend of Doing QA for us and,

Guest 2

and then

Guest 2

You can define the inputs, the outputs, like everything about a function it's, simultaneously

Guest 2

assign it to the function Yeah. I know. It's it's so hard to find everything, you know, especially on a large project. So, rid. Yeah. That's where I'm at. I if I sound exhausted, it's

Topic 4 03:10

Prefer named functions over arrow in variables

Guest 1

I always prefer the first, which is a named function, like, there's certainly, arrow functions have their use, and I'm not,

Guest 1

pooh poohing them at all. I use them all day long. But When you are defining a regular ass function, or whatever. That always happens. It's like you I worked, like, 8 months to launch a course, and then, like, the first reply is, I think it's Broken, and there's, like, something, like, weird.

Sponsored by Linode, LogRocket and FreshBooks

Guest 1

LogRocket, const or var or let

Guest 1

JavaScript session replay, and FreshBooks cloud accounting. We'll talk about all of them partway through the episode.

Topic 6 00:00

Transcript

Announcer

You're listening to Syntax, the podcast with the tastiest web development treats out there. Strap yourself in and get ready. Here is Scott Talinski and Wes Boss.

Guest 1

Welcome to Syntax, the podcast with the tastiest web development treats out there. Today, we've got, rid. The name of the function is equal to, and you do a little arrow function

Topic 7 02:23

Feeling exhausted from prepping for launch

Guest 1

I'm a little exhausted, I gotta say. Yeah. Alright. Well, let's, let's get on into it. First one is

Share

Empowering developers for over 286197052109 milliseconds!