0% found this document useful (0 votes)
2 views8 pages

All Javascript Functions

Uploaded by

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

All Javascript Functions

Uploaded by

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

ALL JAVASCRIPT

FUNCTIONS
alert() → Shows a pop-up alert message.

prompt() → Asks the user for input.

confirm() -> OK/Cancel popup with


true/false.

Parselnt() -> Converts a string into an


intergert

isNaN() -> Checks if a value is not a number

toString() -> Converts a number to a string.


console.log() → Logs a message to the
browser's

setTimeout() → Executes a function after a


delay

SetInterval() → Repeats a function at


intervals

clear Timeout() → Cancels a timeout set by


set setTimeout()

Math.random() → Generates a random


number between O to 1
Math.floor() → Rounds a number down to the
nearest interger.

Math.cell() → Rounds a number up to the


nearest interger.

Math.max() → Returns the largest to the given


numbers.

Math.min() → Return the smallest to the given


numbers

Date() → Return the current date and time

getElementsByld() → Select element by its ID


getElementsByClassName() → Select element by
their class name

getElementsByTagName () → select element by


their tag name

querySelector () → Selects the first element that


matches a CSS selector

querySelectorAll() → Selects all elements


matching a CSS selector

addEventListener() → Adds an event handller to


an element

removeEventListener () → Removes event handler


from an element
chatAt () → Return the charcter at a specified
index in a string

indexOf () → Return the index of the first


occurance of a specified value in a string

replace() → Replace part of a string with


another string

split() → splits a string into an array of


substrings

trim() → Removes whitespace from both


sides of a string
toUpperCase() → Converts a string uppercase

toLowerCase() → Converts a string lowercase

push() → Adds one and more elements to the


end of an array

pop() → Removes the last element of an array

shift() → Removes the first element of an array

unshift() → Adds elemeent to the beginning of


an array
concat() → Combines two or more arrays

join() → joins all elements of an array into a


strings

map() → Creates a new array by applying a


functions to each elementt

filter() → Filters elements based on a condition

forEach() → Executes a function for each


element in an array

reduce()→ reduces the array to a single value


by applying a function

You might also like