0% found this document useful (0 votes)
15 views100 pages

Javascript Keywords

The document provides a comprehensive overview of JavaScript concepts, including variables, functions, loops, and error handling. It explains key terms and methods used in JavaScript programming, such as 'let', 'const', 'async', and various array methods. Additionally, it covers DOM manipulation techniques and data types in JavaScript.

Uploaded by

Febin Felix
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views100 pages

Javascript Keywords

The document provides a comprehensive overview of JavaScript concepts, including variables, functions, loops, and error handling. It explains key terms and methods used in JavaScript programming, such as 'let', 'const', 'async', and various array methods. Additionally, it covers DOM manipulation techniques and data types in JavaScript.

Uploaded by

Febin Felix
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 100

JavaScript

• A language that lets you add interactivity and


logic to your website (like buttons that do
something).
Script
• A block of JavaScript code inside an HTML
page.
Variable
• A container to store data (like a box to keep a
number, word, or anything else).
let
• A way to create a changeable variable.
const
• A way to create a variable that cannot be
changed.
var
• An older way to create a changeable variable
(not recommended for most new code).
Function
• A set of instructions you can reuse whenever
needed.
return
• Sends a value back from a function to
wherever it was called.
if
• Checks if something is true, and runs a block
of code if it is.
else
• Runs another block of code if the if condition
is false.
else if
• Lets you check another condition if the first if
fails.
switch
• A shortcut to check many conditions and
choose which block of code to run.
case
• A possible match inside a switch statement.
default
• A fallback if none of the case options match in
a switch.
for
• A loop that repeats code a set number of
times.
while
• A loop that repeats code while a condition is
true.
do...while
• A loop that runs the code at least once, then
keeps repeating if a condition is true.
break
• Stops a loop or a switch early.
continue
• Skips the current loop step and jumps to the
next one.
try
• Tests a block of code for errors.
catch
• Runs code if an error happens in the try block.
finally
• Runs code after try and catch, no matter what.
throw
• Creates your own error to stop code on
purpose.
new
• Creates a new object or instance from a class.
class
• A blueprint for creating similar objects.
constructor
• A special function inside a class that sets up
the object.
this
• Refers to the object that is currently being
used.
super
• Refers to the parent class when you want to
access or reuse it.
import
• Brings code from another file or module into
your file.
export
• Makes code (like functions, classes, variables)
available to other files.
async
• Makes a function run in the background
without stopping the whole program.
await
• Waits for an async operation (like loading
data) to finish before moving on.
Promise
• An object that represents something that will
finish later (like a package you ordered).
yield
• Used in special functions (generators) to
pause and later continue the function.
typeof
• Checks the type of a value (like number, string,
object).
instanceof
• Checks if an object belongs to a certain class
or type.
delete
• Removes a property from an object.
in
• Checks if a property exists inside an object.
with
• Shortens object property access (but
considered bad practice today).
debugger
• Pauses the code at that point when you're
debugging.
window
• Represents the whole browser window — the
main object for everything.
document
• Represents the webpage itself; lets you
change what's on the page.
console
• Lets you print messages to the browser’s
console (very useful for testing).
alert
• Shows a popup message box on the screen.
prompt
• Shows a popup asking the user to type
something.
confirm
• Shows a popup asking the user to accept (OK)
or cancel.
setTimeout
• Runs a function once after waiting for a
certain time.
setInterval
• Repeats a function over and over after every
time gap.
clearTimeout
• Cancels a setTimeout that hasn’t run yet.
clearInterval
• Cancels a repeating setInterval.
addEventListener
• Lets you run code when something happens
(like a click or hover).
event
• The actual thing that happened, like a click,
input, or keypress.
target
• Refers to the specific element that triggered
the event.
innerHTML
• Lets you read or change the HTML content
inside an element.
innerText
• Lets you read or change just the visible text
inside an element.
value
• Gets or sets the value of form elements (like
what's typed into a text box).
getElementById
• Finds an element by its unique ID.
getElementsByClassName
• Finds all elements with a certain class name.
getElementsByTagName
• Finds all elements with a certain tag name
(like all <div>s).
querySelector
• Finds the first element that matches a CSS-
style selector.
querySelectorAll
• Finds all elements matching a CSS-style
selector.
parentNode
• Refers to an element’s parent in the HTML
tree.
childNodes
• Refers to an element’s children (could be
elements or text).
appendChild
• Adds a new child element to a parent.
removeChild
• Removes a child element from its parent.
createElement
• Creates a new HTML element using JavaScript.
cloneNode
• Copies an element.
JSON
• A way to format and share data easily
(JavaScript Object Notation).
parse
• Turns a JSON string into a JavaScript object.
stringify
• Turns a JavaScript object into a JSON string.
Array
• A list-like collection of items (like [1, 2, 3]).
Object
• A collection of properties in key-value pairs
(like {name: 'John', age: 30}).
Map
• A newer way to store key-value pairs where
keys can be any type.
Set
• A collection of unique values (no duplicates
allowed).
push
• Adds an item to the end of an array.
pop
• Removes the last item from an array.
shift
• Removes the first item from an array.
unshift
• Adds an item to the start of an array.
slice
• Copies part of an array.
splice
• Changes an array by adding/removing items.
forEach
• Runs a function once for each item in an array.
map (array method)
• Creates a new array by changing every item in
the original.
filter
• Creates a new array with only the items that
meet a condition.
reduce
• Uses all array items to create a single value
(like a total).
includes
• Checks if an array or string contains a certain
value.
find
• Returns the first item that matches a
condition.
sort
• Arranges the items in an array in a certain
order.
reverse
• Reverses the order of items in an array.
length
• Tells you how many items are in an array or
how many characters are in a string.
String
• Text in JavaScript (like 'Hello').
Number
• A numeric value in JavaScript.
Boolean
• A true or false value.
null
• An intentional empty value.
undefined
• A variable that hasn't been given a value yet.
Symbol
• A unique value mainly used internally in
JavaScript.
NaN (Not a Number)
• A special value that shows when a number
operation failed.
Infinity
• A value larger than any number.
isNaN
• A function that checks if something is 'Not a
Number.'
parseInt
• Converts a string into an integer number.
parseFloat
• Converts a string into a decimal number.

You might also like