In this comprehensive JavaScript cheat sheet, we've curated a collection of the most commonly used features, methods, and techniques, organized for easy navigation and quick reference. Whether you're brushing up on the basics or exploring advanced concepts, this cheat sheet will serve as your trusty companion on your JavaScript journey.
![JavaScript]()
Why a cheat sheet?
In the fast-paced world of programming, having quick access to essential syntax, functions, and concepts can be a game-changer. That's where a JavaScript cheat sheet becomes invaluable. It serves as a handy reference, providing bite-sized information that helps streamline your coding process and tackle challenges with confidence.
Let's start
let's begin this cheat sheet
On page script
Include external JS file
Functions
Named Function
Arrow Functions
Function hoisting
Map Function
Comments
Logging/Print
Data Types
If - Else Statement
For Loop
While Loop
Do - While Loop
For Each Loop
Numbers
Javascript Math
Strings
Array
JavaScript Window
Location
Returns a location object that contains information about the current url
History
Returns an history object that contains the pages visited by a user
Document
Returns the document object as an html document loaded into a web browser
Navigator
Returns and object containing information about the user's browser
Screen
Returns an object which contains the information about the user's screen
Local Storage
setItem()
Allows you to store values in the localStorage object; accepts 2 parameters: a key and a value.
If arrays or objects, then first convert into strings using JSON.stringify( ) As localStorage can only store strings.
getItem( )
Allows you to access the data stored in localStorage. Simply pass key as the parameter and it will return value accordingly.
removeItem( )
Allows you to remove the data stored in localStorage. Simply pass the key as the parameter, and it will remove both the key and value. (Does nothing when the parameter is left empty)
clear ()
Deletes every item in the localStorage.
key ( )
Allows you to loop through the keys and pass an index as the parameter to retrieve the name of the key.
Date and Time
JavaScript DOM mainuplation
Java Object