10 JavaScript Array methods to simplify your code.

🧵
1. filter()

The `filter()` method creates a new array with all elements that pass the test implemented by the provided function.  ```javascript const words = ['HTML', 'CSS', 'JavaScript', '
2. forEach()

The `forEach()` method executes a provided function once for each array element. ```javascript const words = ['HTML', 'CSS', 'JavaScript'];
3. some()

The `some()` method tests whether at least one element in the array passes the test implemented by the provided function. It returns a Boolean value. ```javascript const myArray = [1, 2, 3, 4, 5]; const evenExi
4. every()

The `every()` method tests whether all elements in the array pass the test implemented by the provided function. It returns a Boolean value. ```javascript const myArray = [1, 2, 3, 4, 5]; const allEven
5. includes()

The `includes()` method determines whether an array includes a certain value among its entries, returning true or false as appropriate. ```javascript const numbers = [1, 2, 3, 4, 5]; console.log(n
6. map()

The `map()` method creates a new array populated with the results of calling a provided function on every element in the calling array. ```javascript const numbers = [1, 2, 3, 4, 5]; const doubled
7. reduce()

The `reduce()` method executes a reducer function (that you provide) on each element of the array, resulting in a single output value. ```javascript const numbers = [10, 20, 30, 40]; const sum =
8. sort()

The `sort()` method sorts the elements of an array in place and returns the sorted array. The default sort order is ascending, built upon converting the elements into strings, then comparing their sequences of UTF-16 code units values. ```javascript const techs = ['HTML', 'CSS', 'JavaScript']; t
9. find()

The `find()` method returns the value of the first element in the provided array that satisfies the provided testing function. ```javascript const numbers = [7, 14, 8, 128, 56]; const fou
10. findIndex()

The `findIndex()` method returns the index of the first element in the array that satisfies the provided testing function. Otherwise, it returns -1, indicating that no element passed the test. ```javascript const numbers = [5, 12, 8, 130, 44]; const ind
Did you find this useful?

Retweet the 1st tweet and help others discover it.

Happy coding!
You can bookmark this thread as a post if you want.

markodenic.com/10-javascript-…

• • •

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

Keep Current with Marko ⚡ Denic

Marko ⚡ Denic 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 @denicmarko

1 Oct
HTML tips you won't see in most tutorials.

🧵
1. The `loading=lazy` attribute

You can use the `loading=lazy` attribute to defer the loading of the image until the user scrolls to them. <img src='image.jpg' loading='lazy' alt='Alternative Text'>
2. Use the `<datalist>` element to create native HTML autocomplete. Codepen preview.  HTML code:   <div class="wrapper"
Read 21 tweets
29 Sep
Useful websites for web developers.

🧵
1. Sidebar (@SidebarIO)

The five best design links, every weekday.

Link: sidebar.io
2. Public APIs (@publicapis)

A collective list of more than 1000 Free Public and Open REST APIs for developers.

LInk: public-apis.io
Read 9 tweets
22 Sep
Useful websites for web developers.

🧵
1. Vercel (@vercel)

Deploy web projects with the best frontend developer experience and highest end-user performance.

Link: vercel.com
2. UI Garage (@uigarage)

Daily handpicked UI inspiration & patterns.

Link: uigarage.net
Read 9 tweets
8 Sep
Youtube channels to learn Web Development.

🧵
1. Traversy Media (@traversymedia)

Traversy Media features the best online web development and programming tutorials for all of the latest web technologies.

Link: youtube.com/c/TraversyMedia
2. FreeCodeCamp (@freeCodeCamp)

Learn to code — for free.

Link: youtube.com/c/Freecodecamp
Read 14 tweets
6 Sep
Googling is one of the most important skills for every developer. Here are 10 tips to Google efficiently!

🧵
1. Use quotes to force an exact-match search:

"what is javascript" Google search exact match  example.
2. AND operator will return only results related to both terms:

html AND css Google search with AND keyword.
Read 13 tweets
5 Sep
HTML tip:

Use the `start` attribute to change the starting point for your ordered lists. Code:  <ol start="11">   <li>HTML</li>   <li>CSS</
If you're learning HTML, CSS or JavaScript be sure to follow me and never miss tips like this.
You can find more HTML tips here.

markodenic.com/html-tips/
Read 4 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!

:(