Dictionary
A-Z
Name | Examples |
[...array] | var a = [1,2,3,4,5] [...a] //Equal to [1,2,3,4,5] |
`Hello ${a}` | var a = "John" //Equal to "Hello John" |
abs() | Math.abs(-1.234) |
add() | var unique = new Set([1,2,3,4,5]) |
alert() | alert("happy new year") |
acos() | Math.acos(0.4) //Equal to 1.1592794807274085 |
acosh() | Math.acosh(4) //Equal to 2.0634370688955608 |
addEventListener() | |
altkey | function isKeyPressed(event) { if (event.altKey) { document.getElementsByTagName("p")[0].style.color = "#ff0000"; } else { alert("The ALT key was NOT pressed!"); } } |
appendChild | |
appCodeName | navigator.appCodeName |
appName | navigator.appName |
appVersion | navigator.appVersion |
asin() | Math.asin(-0.4) //Equal to -0.41151684606748806 |
asinh() | Math.asinh(20) //Equal to 3.6895038689889055 |
assign() | const target = { a: 1, b: 2 };
const source = { b: 4, c: 5 }; const returnedTarget = Object.assign(target, source); console.log(target); // expected output: Object { a: 1, b: 4, c: 5 } console.log(returnedTarget); // expected output: Object { a: 1, b: 4, c: 5 } |
atan() | Math.atan(20) //Equal to 1.5208379310729538 |
atanh() | Math.atanh(0.2) //Equal to 0.2027325540540822 |
attribute | |
availHeight | screen.availHeight |
boolean? a : b | 4===5? true : false //Equal to false |
break | |
cbrt() | Math.cbrt(8) //Equal to 2 |
ceil() | Math.ceil(2.145) //Equal to 3 |
charAt(num) | "nop".charAt(1) //Equal to "o" |
childNodes | var c = document.body.childNodes; c[0]; |
clearInterval() | clearInterval(setInterval(alert("Hi")),3000) |
click | |
colorDepth | screen.colorDepth |
confirm() | confirm("happy new year") |
concat() | [1,2,3,4].concat([5],[6]) //Equal to [1,2,3,4,5,6] |
console.log() | console.log("1+2") |
const | const a = "apple" //globle |
continue | |
copyWithin() | [1,2,3,4,5].copyWithin(2,1) //Equal to [1,2,2,3,4] |
cos() | Math.cos(32) //Equal to 0.8342233605065102 |
cosh() | Math.cosh(32) //Equal to 39481480091340.34 |
cost() | Math.cost() |
createElement() | var para = document.createElement("p") |
createTextNode() | document.createTextNode("This is new.") |
close() | window.close() |
Date() | var a = new Date() |
dblclick | |
do……while | var i = 0 do{ document.write(i) i++ }while(i<5) |
E | Math.E //Equal to 2.718281828459045 |
endsWith | "happy".endsWith("y") //Equal to true |
entries() | arrSet = {a:1,b:2,c:3} Object.entries(arrSet) //Equal to [["a",1],["b",2],["c",3]] |
eval() | eval("1+2") //Equal to 3 |
every() | [1,2,3,4,5].every(x => x<4) //Equal to false |
exp() | Math.exp(20) //Equal to 485165195.4097903 |
fill() | [1,2,3,4,5].fill("h") //Equal to ["h","h","h","h","h"] |
find() | [1,2,3,4,5].find(x => x>2) //Equal to 3 |
findIndex() | [1,2,3,4,5].find(x => x>2) //Equal to 2 |
flat() | [1,2,3,[4,5]].flat() //Equal to [1,2,3,4,5] |
floor() | Math.floor(2.145) //Equal to 2 |
freeze() | Object.freeze(obj) |
forEach() | [1,2,3,4,5].forEach((x,y)=>console.log(y+ "" +x)) |
for loop | for(i=0; i<6; i++){} |
for……in | |
for……of | |
from() | Array.from("12") //Equal to ["1","2"] |
function(){} | function(){ return "happy new year"; } \\Equal to () => "happy new year" |
getElementById(id) | document.getElementById("demo") |
getElementsByTagName(name) | getElementsByTagName("p") |
getElementsByClassName(name) | getElementsByTagName("demo") |
getTime() | new Date().getTime() //Equal to time from 1970.1.1 |
getFullYear() | new Date().getFullYear() //Equal to 2020 |
setFullYear() | new Date().setFullYear(2019) //Equal to 2019yr |
getUTCFullYear() | new Date().getUTCFullYear() //Equal to 2020 |
setUTCFullYear() | |
getMonth() | new Date().getMonth() //Equal to Month -1 |
setMonth() | |
getUTCMonth() | |
setUTCMonth() | |
getDate() | new Date().getDate() //Equal to today number |
setDate() | |
getNamedItem() | var x = btn.attributes.getNamedItem("class").value |
getUTCDate() | |
setUTCDate() |