1. String Functions

FunctionPurposeExample
toUpperCase()Convert text to uppercase"hello".toUpperCase()
toLowerCase()Convert text to lowercase"HELLO".toLowerCase()
trim()Remove extra spaces" hi ".trim()
lengthGet string length"hello".length
replace()Replace text"a".replace("a","b")

 

2. Array Functions

FunctionPurposeExample
push()Add element at endarr.push(10)
pop()Remove last elementarr.pop()
shift()Remove first elementarr.shift()
unshift()Add element at startarr.unshift(1)
map()Modify array elementsarr.map(x => x*2)
filter()Filter elementsarr.filter(x => x > 10)
forEach()Loop through arrayarr.forEach()

 

3. Number Functions

FunctionPurposeExample
parseInt()Convert to integerparseInt("10")
parseFloat()Convert to decimalparseFloat("10.5")
Number()Convert to numberNumber("25")
isNaN()Check Not a NumberisNaN("abc")

 

4. JSON Functions

FunctionPurposeExample
JSON.stringify()Object → StringJSON.stringify(obj)
JSON.parse()String → ObjectJSON.parse(str)

 

5. Common Browser Functions

FunctionPurposeExample
alert()Popup messagealert("Hello")
prompt()User inputprompt("Enter name")
confirm()OK/Cancel dialogconfirm("Sure?")
console.log()Debug outputconsole.log("Hi")
document.write()Write on pagedocument.write("Hello")

 

6. Timer Functions

FunctionPurposeExample
setTimeout()Run after delaysetTimeout(fn,1000)
setInterval()Run repeatedlysetInterval(fn,1000)
clearTimeout()Stop timeoutclearTimeout(id)
clearInterval()Stop intervalclearInterval(id)