โ To iterate through each element in the array
โ Perform a task on each element
โ Not suitable if task is supposed to return some value
โฉโฉ forEach() is also available in Set.prototype and Map.prototype
โ Array.prototype. map()
โ Use Case
โ To iterate through each element in the array
โ Perform a task on each element which returns a value
โ Returns a new array with all returned values
โ Not suitable if task doesn't return any value
โ Array.prototype.reduce()
โ Use Case
โ To iterate through each element in the array
โ Perform a task on each element which accumulates the previous returned value with current element to return a new value
โ Example
โ Sum of all items
โ Max of all items
โ Array.prototype.every()
โ Use Case
โ To iterate through elements in the array until a certain condition is not met
โ The task performed on each element must return a boolean value
โ Stops iterating when condition is not met. Hence, it's not suitable for skipping.
โ To convert entire string to lowercase alphabets, use toLowerCase()
โ To convert entire string to uppercase alphabets, use toLowerCase()
โฉโฉ These methods returns a new string
โโ String.prototype.substring()
โ Use Case
โ To fetch a part of the string between 2 indexes
โฉโฉ substring() returns a new string
โโ String.prototype.indexOf()
โ Use Case
โ To find the very first occurrence of a "substring" in the original string
โ We can also mention from which index the occurrence should be checked
20. String.prototype.charAt()
โ Use Case
โ To fetch the character at a specific position of a string.
โ The character fetched is in UTF-16 and returned as a string
โโ String.prototype.trim()
โ Use Case
โ To remove whitespace from both ends of a string
โฉโฉ trim() returns a new string
โโ Math.floor()
โ Use Case
โ To get the largest integer less than or, equals to the given number
โโ Math.random()
โ Use Case
โ To get a floating point pseudo random number in the range of 0 to less than 1
โ It can be multiplied by any number to make a random number being generated in the range of 0 to less than that number
โโ setTimeout()
โ Use Case
โ To execute a function or, piece of code after a timer expires
โ The code is executed only for once.
โ It is an asynchronous function. It shouldn't be used where pausing of execution is intended.
โโ setInterval()
โ Use Case
โ To execute a function or, piece of code repeatedly with a fix time delay
โ The code is ensured to be executed each time after the time delay. But not "exactly" after the time delay.
โฉโฉ Cancel further execution using clearInterval()
๐ญ Feedbacks
โง I have picked 25 out of 100s of methods available. My focus was to show you a "learning method" which you may apply wherever you wish.
โง Share your feedbacks on these. It would definitely help me to share better contents with you.
End of ๐งต
If you are a new learner or, someone who finds difficulties in learning JavaScript, you have reached to right person here.
You may like to go through "JavaScript" & "JavaScript Infographics" moments to see what I share regularly.
To never miss any, Follow Me โ
โข โข โข
Missing some Tweet in this thread? You can try to
force a refresh
๐ฆ All inline & block-level elements in HTML / CSS
Check inside the ๐งต for
โง Interesting details about inline & block-level
โง Link to high resolution image
โฉ
๐ Table of Contents
โ Introduction
โ inline-level
โ block-level
โ Changing Element Level
โ List of inline-level elements
โ List of block-level elements
โ Link to High Resolution Image
๐ฅ Disclaimer
โ I have compiled these information with all sincerity. But in case you find any omissions or, wrong representations, ๐ฌ me.
โ If you have any suggestions or, feedbacks, share those with me. I am eager to hear from you.
โ What is Semantic HTML?
โ Examples of Semantic Elements
โ Benefits of using Semantic HTML
โ.โ Improve site's SEO positioning
โ.โ Help your site more accessible
โ.โ Closer to natural language, easier to maintain
โ Should we not use "div"?
โ What is Semantic HTML?
โ Semantic HTML adds essential meaning to the web page rather than just presentation.
โ This lets web browsers, search engines, screen readers, RSS readers, and ultimately users understand it in a better way.
โ Static Methods
โ Accepts -ve Index
โ Returns Boolean
โ Returns Index
โ Returns new Array
โ Modifies Existing Array
โ Iterates through entire Array
โ Iterates Partially
โ Checks Elements "as it is"
โ Checks Elements custom way
โโ Accepts a callback