JavaScript 💡

14 Array Methods that will land you the next job.
Learn and understand what they do and how to use them.

Explanation and examples below 🧵👇
🔸 map

The map() method creates a new array populated with the return value of the callback function for each element in the array.
🔸 forEach

The forEach() method executes a provided function once for each array element.
The callback function does not expect a return value, and the forEach() method itself also returns undefined.
🔸 filter

The filter() method creates a new array containing only the elements that "pass the test" implemented by the callback function.
We call this type of callback a predicate function.
🔸 find

The find() method behaves similarly to the filter() method, but it only returns a single element.
This method will stop at the first element that "pass the test", and return that.
If none exists, it will return undefined.
🔸 findIndex

The findIndex() method behaves similarly to the find() method, but it returns an index instead of the element,
This method will stop at the first element that "pass the test", and return its index.
If none exists, it will return -1.
🔸 reduce

The reduce() method takes a callback with (at least) two arguments:
An accumulator and the current element.

For each iteration, the return value of the callback function is passed on as the accumulator argument of the next iteration.
🔸 some

The some() method takes a predicate function and return true if any of the elements in the array "passes the test".
🔸 every

The every() method takes a predicate function and returns true if all of the elements in the array "pass the test".
🔸 includes

The includes() method checks if an array includes a certain value among its elements, returning true or false.
🔸 fill

The fill() method replaces all the elements in an array to a given value.
🔸 reverse

The reverse() method reverses the order of the elements in the array.
🔸 flat

The flat() method creates a new array with all sub-array elements flattened into it.
You can specify a depth. The default is 1.
🔸 flatMap

The flatMap() method applies a callback to each element of the array and then flatten the result into an array. It combines flat() and map() in one function.
🔸 sort

The sort() method is used to sort the elements of an array and returning the sorting array.
Be aware that this method is mutating the original array.
I recently published an e-book with 65+ code-snippets including explanations for JavaScript, React, NodeJS, and AWS Lambda.

Pick it up for ⚡ free ⚡ here on Gumroad 👇

🔗 simonhoiberg.gumroad.com/l/65-js-codesn…

• • •

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

5 Aug
3 things we are extremely proud of as SaaS founders:

🔸 We are bootstrapped 💪
🔸 We've been driving sales from day 1
🔸 We had product-market-fit from day 1

How did we do that? 👇🧵
🔸 We are bootstrapped

Even though we generated revenue from the beginning, we were not profitable.

Of course, it costs money to get started.

There are two main reasons why this was possible to us 👇
1. Both my Co-Founder, @SimonGronborg and I are software developers with a lot of experience.

No doubt! When running a SaaS business, paying engineers to build your product will be the biggest expense for a long time!

In our case, we've been able to do that part ourselves.
Read 16 tweets
3 Aug
You should start contributing to Open-Source.

Here are 6 ways you can heavily benefit from it.

👇🧵
1️⃣ Become a better developer

Maybe you are still entry-level.
Or maybe you are an experienced developer.

No matter the level, the world of tech is a place where you can (and should) strive to learn something new.

Open-Source allows you to build up skills and become better.
If you are an entry-level or newly graduated junior, you may find yourself stuck in the famous “cannot-get-hired-because-I-don’t-have-experience” deadlock.

Open-Source doesn’t require you to be hired, nor does it require you to have a degree or a resume.
Read 26 tweets
22 Jul
How to make a contribution to an Open-Source Project.

If you are new to this, it may all seem a bit intimidating!

Let me explain the process and give you some tips and best practices.

🧵👇
First of all - why even care about Open-Source?

🔹 Become a better developer
🔹 Become a great collaborator
🔹 Improve the software that you use
🔹 Grow a reputation
🔹 Attract recruiters.
...Just to name a few!

Now that we got that straight - let's get started 👇
🔹 Find a good project to contribute to (1/2)
You want to look for a project that accepts new contributors and is likely to review PRs.

You also want to find a place that has a healthy tone in the discussions and polite and grateful maintainers.
Read 18 tweets
20 Jul
Did you know that FeedHive is built using a fully serverless architecture with monthly server costs of <$10?

This is how we did it 🚀

Learn how to create a Full Stack Serverless Application using React and Amazon Web Services.

🧵👇
First of all - there are many different ways to compose a Serverless Stack application.

With that said, let's start.

Tech Stack:
🔹 DynamoDB
🔹 GraphQL
🔹 AWS Lambda
🔸React
🔸Static hosting in AWS S3

Tools:
🔵 AWS Amplify
🔵 Serverless
🔹 DynamoDB (1/3)

A managed database provided by AWS.

It supports both key-value entries and documents.
That means that a field can contain a single value, such as a string or a number, but can also contain a document, i.e. a JSON-object.
Read 22 tweets
19 Jul
Want to start a business?

Keep it simple!
Become a solopreneur and start on your own.

🔸 You can get started almost for free.
🔸 You don't need to quit your regular job.

Here are 5 ideas + strategies you can use to get started 🚀

🧵👇
⚠️ Disclaimer:
You're not gonna be rich overnight.
Building up a business requires hard work.

The good news is - it's probably easier than you think 😉

Keep reading 👇
If you're interested in this topic, be sure to check the video version of this thread as well. I go into much more details here 👇

Read 30 tweets
6 Jul
Did you know that Slack started out as an online game made in Flash? 😳

How did they go from a Flash game to a $630M ARR SaaS?

Let's take a look 👇🧵 Image
"Never mind the part where we first tried to make a web-based massively multiplayer game and failed" - the Co-Founder of Slack says.

They spent almost 4 years working on that game.

Today, Slack is valuated to $5B.

Let's see what we can learn from Slack 👇
🔹 They took their own medicine

Slack became their own first users.
They had been using IRC while developing Glitch, the Flash-based game, and the team appreciated how this chat-based communication channel allowed them to work more focused and productive.
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

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

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!

:(