3min chapter

Syntax - Tasty Web Development Treats cover image

Code Styles: Readable Rules and Petty Preferences

Syntax - Tasty Web Development Treats

CHAPTER

JavaScript - Is There a Way to Define Functions?

There's many ways to define a function in JavaScript. Probably the two most popular ones are if you're just defining like a top level function, not a method or ever. I always prefer the first, which is a named function over sticking in a very well. But there has been a recent kind of thing that's popped up in my code base,. So in TypeScript, you can define the inputs, the outputs, like everything about a function as a type and then assign it to the function much more easily using the const do something way. Even if you're not using an arrow function. If you're saying const do something is equal to function do something. Rather than doing them separately

00:00

Get the Snipd
podcast app

Unlock the knowledge in podcasts with the podcast player of the future.
App store bannerPlay store banner

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode

Save any
moment

Hear something you like? Tap your headphones to save it with AI-generated key takeaways

Share
& Export

Send highlights to Twitter, WhatsApp or export them to Notion, Readwise & more

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode