Simon Høiberg Profile picture
Aug 31, 2021 7 tweets 3 min read Read on X
5 annoying JavaScript habits that you want to avoid.

I see these 5 over and over.

They are bad for performance, readability, and they signal a lack of basic understanding of the JavaScript language.

Let me go through them here 🧵👇 Image
Using map() instead of forEach().

Arrays expose different methods for different purposes.
If you are simply iterating through a list, you want to use forEach(), not map().

Using the wrong method may miscommunicate the intent. Image
Creating an extra arrow function (thus an extra function closure), while not being necessary is both bad for readability and bad for performance.

It's a sign that the author doesn't truly understand that in the nature of JavaScript, you can pass functions by reference. ImageImage
This one is more common in JavaScript than in most other languages Down pointing backhand index

Insisting on using a one-liner, instead of writing clean, thorough, and readable code, is something that I see even experienced senior developers do.

Please, don't be that guy! ImageImage
Avoid wrapping the whole function body in an if-statement.
It creates an extra level of indentation, thus becomes more unreadable.

Instead, use a guard clause to break out early. ImageImage
If you don't need the result of one resolved Promise in order to execute the next one, don't run Promises in a sequence.

This one is mostly a performance issue.
Missing out on the opportunity to run Promises in parallel can severely slow down your application. Image
Would you add something to this list?
Are there any recurrent code-smells and annoying patterns that you notice over and over in your work?

Please, share with us 😊

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Simon Høiberg

Simon Høiberg Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @SimonHoiberg

Mar 14, 2023
GPT-4 is about to launch 🚀
And we're going to see something groundbreaking!

According to early announcements, GPT-4 is going to be multimodal, which means both prompts and outputs can be:

→ Text
→ Images
→ Videos
→ Audio

Instead of simply text → text as we know now. Image
Let's gooo 🚀 Image
Read 4 tweets
Mar 13, 2023
How to validate your SaaS idea *before* you start building.

→ In less than 10 days
→ For less than $200
→ In 3 simple steps

Let's see how 🧵👇
Step 1: Set up a landing page.

Describe your product idea, the features, and the problem you want to solve.

Tools:
shuffle.dev to create the landing page
chat.openai.com to create the copy
figma.com to create the graphics
On the pricing page, include a simple form to join the waiting list for your product.

Use this to collect emails.

Tools:
zapier.com to handle form submissions
airtable.com to store the emails
Read 12 tweets
Jan 11, 2023
GPT-4 is going to launch soon.
And it will make ChatGPT look like a toy...

→ GPT-3 has 175 billion parameters
→ GPT-4 has 100 trillion parameters

I think we're gonna see something absolutely mindblowing this time!

And the best part? 👇
Average developers (like myself), who are not AI or machine learning experts, will get to use this powerful technology through a simple API.

Think about this for a second...

It's the most powerful, cutting-edge technology *in the world*, available through a Low-Code solution!
If you're not already planning on starting an AI-based SaaS or thinking about how to build AI into your current solution...

👉 Start now!

Cause this is gonna be one of the biggest opportunities of this century 🚀
Read 4 tweets
Dec 27, 2022
I run a 6-figure business entirely online.

But the amount of hats I need to wear is exhausting 🤯

Luckily, I can be a:
→ Copywriter
→ Data analyst
→ Social media manager
→ Head of Operations
→ Graphic designer
→ VP of Finance
→ Web developer

...using these 7 tools ↓
🔹 TubeBuddy

I couldn't imagine running YouTube as a business without TubeBuddy.

Keyword research, channel analytics, thumbnail analysis, A/B testing and much more.

🔗 tubebuddy.com
🔹 FeedHive

FeedHive is the ultimate tool for entrepreneurs who want to build a social media presence at scale.

I gained +200K followers across 5 different platforms in < 2 years.

I've seen people go viral with FeedHive more times than I can count.

🔗 feedhive.io
Read 9 tweets
Nov 28, 2022
8 No Code tools you can use to set up a SaaS business from scratch!

🌐 Website
⚙️ Web app
📱 Mobile app
🔁 Automation

(...I bet some of these are new to you)

Let's take a look ↓
🌐 Create a stunning website for your business!

→ Shuffe (shuffle.dev)
→ Versoly (versoly.com)
⚙️ Create the actual SaaS web application.

→ Bubble (bubble.io)
→ Wized (wized.io)
Read 7 tweets
Nov 8, 2022
How to validate your SaaS idea *before* you start building.

→ In less than 10 days
→ For less than $200
→ In 3 simple steps

Let's see how 🧵👇
Step 1: Set up a landing page.

Describe your product idea, the features, and the problem you want to solve.

Tools:
shuffle.dev to create the landing page.
copy.ai to create the copy.
figma.com to create the graphics.
On the pricing page, include a simple form to join the waiting list for your product.

Use this to collect emails.

Tools:
zapier.com to handle form submissions.
airtable.com to store the emails.
Read 13 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(