Marko Denic Profile picture
Oct 5, 2021 13 tweets 4 min read Read on X
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

Mar 19
CSS tips you won't see in most tutorials:
1/ The `shape-outside` CSS property defines how content will wrap around an element. Image
2/ Pulse animation

Make a nice pulse animation. It's super useful for quickly grabbing user's attention.

Read more here: markodenic.com/css-pulse-anim…Image
Read 12 tweets
Sep 30, 2024
Use these 5 GitHub repositories to improve your programming skills:
1/ Free Programming Books

Freely available programming books.

github.com/EbookFoundatio…
2/ The Art of Command Line

Master the command line, in one page. Available in 18 languages.

github.com/jlevy/the-art-…
Read 7 tweets
Sep 23, 2024
Free learning platforms:
1/ edX (@edXOnline)

EdX offers interactive online courses from the best universities in the world (MITx, HarvardX, BerkeleyX...).
Subjects include biology, economics, chemistry, computer science, business and more.

edx.org
2/ freeCodeCamp (@freeCodeCamp)

14 certifications available:

1. Responsive Web Design
2. JavaScript Algorithms and Data Structures
3. Frontend Libraries
4. Information Security
5. Scientific Computing with Python
...

freecodecamp.org/learn/
Read 10 tweets
Aug 18, 2024
If you want to read books online for free, open this:
1/ Project Gutenberg

Choose among free epub and Kindle eBooks, download them or read them online.

gutenberg.org
2/ PDF Drive

PDF Drive is a search engine for PDF files. Thousands of eBooks for you to download for free.

pdfdrive.com
Read 7 tweets
Jun 10, 2024
Certifications you can take { for free }:
In this thread, you will find websites where you can get free certifications.

Software Engineering, Marketing, Project Management...
1/ Digital Marketing (by @Google)

There are 26 modules to explore, all created by Google trainers, and packed with practical exercises and real-world examples to help you turn knowledge into action.

learndigital.withgoogle.com/digitalgarage/…
Read 9 tweets
Jun 5, 2024
Use `console.log()` like a pro.

Using `console.log()` for JavaScript debugging is the most common practice. But, there is more…

🧵
1/ The most common Console methods:

console.log() – For general output of logging information.
console. info() – Informative logging.
console.debug() – A message to the console with the log level debug.
console.warn() – A warning message.
console.error() – An error message. Image
2/ Custom CSS styles for a console.log():

The `console.log` output can be styled in DevTools using the CSS format specifier. Image
Read 15 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!

:(