Top Ten Things you must know In JavaScript

1.Array.prototype.push()

The push() function appends the arguments given to it, in order, to the end of the array. It modifies the array directly, rather than creating a new array.

When you make a call to push(), it returns the total number of items in the array, after any provided arguments have been added to the end of the array

The JavaScript indexOf() function searches an array for an element that contains a specific value, then returns the very first index that contains that value. You can provide a starting index to the function if you like, otherwise searching will begin from index 0.

2.Array.prototype.indexOf()

The lowest index that is greater than or equal to the start of the array at which the element is equal to the given value. If no match is found, the indexOf() function returns -1.

3.Array.prototype.slice()

The slice() function returns a new array that contains all of the elements of the original array from the element specified by the starting point provided, and up to but not including, the element specified by the ending point provided.

4.Array.prototype.map()

This is a very useful JavaScript function, and made use of all the time in professional software. The map() function loops over every element in the array, executing a callback function on each item. Once map() has completed looping through the array, it takes the results from each callback applied to each element, and returns those results in their entirety as an array. You are left with a new array with updated values, and an old array which has the original values. These two arrays are equal in length. When the callback is invoked, it is done so with three arguments. Those are the value of the element, the index of the element, and the Array object being traversed. If the optional second parameter is provided to map(), it will be used as the this value for each execution of the callback

5. String.prototype.replace()

The replace() function returns a new string with matches of the string or regular expression replaced by any replacements made. The string it is called on does not change, only the return value is modified.

6.String.prototype.charAt()

The charAt() function stands for character at. You can find the exact location of a given character in a string when you use this function. It almost reads like, “Tell me the character at position x”. In order for the charAt() function to do it’s job, you must provide an index parameter between 0 and one less than the length of the string you would like to perform the charAt() function on. If the index provided as a parameter is not between 0 and string.length − 1, this function returns an empty string.

7. String.prototype.match()

What string.match() return

The match() function makes use of powerful regular expression patterns. In order for match() to work, you must pass it one parameter, which is a regular expression. match() will then use that pattern to find all matches in the given string, then return an array of any matches. If there are no matches based on the regular expression you pass in, then match() returns null.

8. String.anchor

What string.anchor() return

Return Value

Returns the string having the anchor tag.

9.String.prototype.substring()

The substring() function has two parameters, those being indexStart and indexEnd. The indexStart parameter is required and specifies the position of where to start the extraction of characters. The indexEnd is optional and specifies the location where the extraction of characters should end. The character that is at the indexEnd position, is not actually included in the extracted substring. If the indexEnd parameter is not provided, then all characters from the start position until the end of the string are extracted. A curious behavior of the substring() function is that if the value of indexStart is greater than the value of indexEnd, substring() will automatically swap these two arguments!

10.String.prototype.fromCharCode()

The fromCharCode() function is used to create a string from Unicode encodings. You pass one or more integers to the fromCharCode() function as parameters that specify the Unicode encodings of the characters in the string to be created.

--

--

--

Computer science student

Love podcasts or audiobooks? Learn on the go with our new app.

Why Javascript web developer should use react library

Mobile App Development — Tools & Technologies for 2019

How To Make A Basic HTML Form Upload Files To Your Server Using Multer In A Node.js/Express App

Cookie Based Authentication Using Flask and Vue.js: Part 2

How to Observe Changes to the DOM without using a JavaScript framework

Deploy a Node.js Bitblog in 3 Steps

How Refactoring Too Late Is Killing Your Productivity

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Md.Mehedi Hasan Rifat

Md.Mehedi Hasan Rifat

Computer science student

More from Medium

🟢 How to focus by NOT focusing (on everything)

Why Success and Fame Attract Haters

Our Major Secret to Figuring Out a College Degree

How to fight against FOMO as a junior developer?

FOMO screenshot with its definiton…