Logo

Codcups

Complete Java-Script Reference's

Intro Of Java Script?

JavaScript (JS) is a high-level, interpreted scripting language primarily used to create interactive effects within web browsers. It is one of the core technologies of the World Wide Web, alongside HTML and CSS.

JavaScript Reference Table

🔹 1. JavaScript Keywords

KeywordDescription
breakExits a loop or switch statement
caseDefines a case in a switch statement
catchDefines a block to handle errors
classDeclares a class (ES6)
constDeclares a block-scoped constant
continueSkips current loop iteration
debuggerStops execution for debugging
defaultDefines default block in switch
deleteDeletes a property from an object
doStarts a do...while loop
elseDefines the false path of if statement
exportExports functions/variables (ES6 Modules)
extendsInherit class from another (OOP)
finallyExecutes after try/catch block
forBegins a for loop
functionDeclares a function
ifExecutes if a condition is true
importImports modules (ES6)
inChecks if property exists in object
instanceofChecks if object is an instance
letDeclares a block-scoped variable
newCreates an instance of object/class
nullRepresents null or "nothing"
returnExits from a function and returns a value
superRefers to parent class
switchConditional branching with multiple cases
thisRefers to current object
throwThrows an exception
tryDefines block to test for errors
typeofReturns variable type as string
varDeclares a variable
voidEvaluates an expression without returning
whileStarts a while loop
withExtends scope chain
yieldPauses/resumes generator function

🔹 2. JavaScript Data Types

TypeExample
String"Hello World"
Number42, 3.14
Booleantrue, false
UndefinedVariable declared but not assigned
Nullnull
Object{ name: "John", age: 25 }
Array[1, 2, 3]
Functionfunction() {}
SymbolSymbol("id")
BigInt12345678901234567890n

🔹 3. JavaScript Operators

Arithmetic Operators

OperatorDescriptionExample
+Additiona + b
-Subtractiona - b
*Multiplicationa * b
/Divisiona / b
%Modulus (Remainder)a % b
**Exponentiationa ** b
++Incrementa++
--Decrementa--

Assignment Operators

OperatorDescription
=Assign
+=Add and assign
-=Subtract and assign
*=Multiply and assign
/=Divide and assign
%=Modulus and assign

Comparison Operators

OperatorDescription
==Equal
===Strict equal (value + type)
!=Not equal
!==Strict not equal
>Greater than
<Less than
>=Greater or equal
<=Less or equal

Logical Operators

OperatorDescription
&&Logical AND
||Logical OR
!Logical NOT

🔹 4. Control Structures

StructureDescription
if...elseConditional execution
switchMulti-branch selection
forLoop with counter
whileLoop with condition
do...whileLoop at least once
breakExit loop
continueSkip current iteration

🔹 5. DOM Tags/Methods

Method / PropertyDescription
document.getElementById()Selects element by ID
document.querySelector()Selects first matching element
innerHTMLGets/sets HTML content
textContentGets/sets text content
classList.add()Adds a class
classList.remove()Removes a class
createElement()Creates an HTML element
appendChild()Appends child element
addEventListener()Adds event to an element

🔹 6. Common Built-in Functions

FunctionDescription
alert()Shows popup alert
console.log()Outputs message to console
parseInt()Converts string to integer
parseFloat()Converts string to float
isNaN()Checks if value is NaN
typeofReturns data type
JSON.stringify()Converts object to JSON string
JSON.parse()Converts JSON string to object

Click to go back on notes page.