Ultimate JavaScript CheatSheet

Minal Vaity
5 min readJan 30, 2021

I’ve been revising JavaScript for days now and I realized why not make a cheatsheet to read in one go. Cheat Sheets are something developers need always for reference. So here I have compiled many JavaScript reference codes. See the classification and find it. This post is helpful for learners and developers.

JavaScript Number Method Cheat Sheet

toString() : returns a number as a string.

toExponential() : returns a string, with a number rounded and written using exponential notation.

toFixed() : returns a string, with the number written with a specified number of decimals

toPrecision() : returns a string, with a number written with a specified length

valueOf() : returns a wrapped primitive value of a number.

JavaScript String Methods Cheat Sheet

charAt() : Returns the character at the specified index

concat() : Joins two or more strings, and returns a copy of the joined strings

replace() : Searches for a match between a substring (or regex) and a string and replaces the matched substring with a new substring

search() : Searches for a match between a regex and a string, and returns the position of the match

slice() : Extracts a part of a string and returns a new string

trim() : Removes whitespace from both ends of a string

substr() : Extracts the character from a string, beginning at a specified start position, and through the specified number of character

toLowerCase() : Converts a string to lowercase letters

toUpperCase() : Converts a string to uppercase letters

JavaScript Array Method Cheat sheet

indexOf() : Search the array for an element and returns its position

concat() : Joins two or more arrays, and returns a copy of the joined array

join() : Joins all elements of an array into a string

push() : Adds an element to the array at the end, and returns the new array length

pop() : Removes the last element of an array, and returns that element

reverse() : Reverses the order of the elements in an array

sort() : Sorts the element of an array

shift() : Removes the first element of an array, and returns that element

unshift() : Adds a new element to an array at the beginning

toString() : Converts an array to string, and returns the result

Get Date Methods Cheat Sheet

getFullYear() : Returns the year of the specified date as a 4 digit number (yyyy)

getMonth() : Returns the month in the specified date as a number (0–11)

getDate() : Returns the day of the month for the specified date as a number (1–31)

getHours() : Returns the hour for the specified date (0–23)

getMinutes() : Returns the minutes in the specified date (0–59)

getSeconds() : Returns the seconds in the specified date (0–59)

Thanks For Reading | Happy Coding 😎

--

--