14 Array Methods that will make your life easier.
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.
• • •
Missing some Tweet in this thread? You can try to
force a refresh
For anyone ambitious about taking your career to the next level:
You need to learn how to sell.
I was an account manager before going full-time in my consulting business.
Here are 5 quick tips on how to sell 🧵👇
Start by recognizing the importance of it!
A lot of people immediately feel this sense of resentment when they hear the word "selling".
It's these annoying people who want to push something on to you, who only care about money. They are manipulative and dishonest.
Yes, some of them are.
But certainly not everyone!
In fact, we are all salesmen.
When you try to convince your partner, why you should go to this specific restaurant tonight, or why your yearly vacation should go to this specific place; you sell 🔥
8 great ways to create passive income from your coding skills!
These are good opportunities to start a side hustle since they require almost no initial investments.
Start hustling 🧵👇
1️⃣ Write articles on Medium
Teach others your wisdom through technical articles on Medium.
You can choose to put the most popular ones behind a paywall.
Good writers can generate up to $6000/month in passive income.
2️⃣ Create themes
CMS-Systems like WordPress, Joomla, and Drupal are still widely used.
Create themes and sell them on Envato Market.
Some top-sellers make a substantial amount of money on this 👇 themeforest.net
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.