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.
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.
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.
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.
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 👇🧵
"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.