timer
intermittent
open
let <timer name> =setInterval(<function name>,<time(ms)>)
let <timer name> =setInterval(function(){},<time(ms)>)
return is id number
clear
clearInterval(<timer name>)
delayed
open delayed
let <timer name> =setTimeout(<function name>,<time(ms)>)
clear
clearTimeout(<timer name>)
this object
this
when a function is passed to another function call
Change direction
-
call
Call a function and change this to point to
<function>.call(<thisArg>,<arg1>,<arg2>,...)- thisArg:The specified ‘this’ points to
- arg1,arg2:Transferred parameters
-
apply
Call a function and change this to point to
<function>.apply(<thisArg>,[<argsArray>])- thisArg:The specified ‘this’ points to
<argsArray>
:The parameters passed must be included in the array
-
bind
Will not call a function but will change it to point to
<function>.bind(<thisArg>,<arg1>,<arg2>,...)- thisArg:The specified ‘this’ points to
- arg1,arg2:Transferred parameters
- return:Pointing function
callback function
representing the current environment, who is clling it
get site and size
<DOM>.getBoundingClientRect()
windows
- windows - navigator - loctation - document - history - screen
location
location
saved various parts of the url
attribute
- href:full url
- search:?The latter part
- hash:#The latter part
function
-
reload(
<parameter>
)true:force flush
navigator
navigator
browser related information
history
history
history and address bar operations
history function
- forward
- back
- go(
<number>
):positive number forward,negative number backward
storage
localstorage
localStorage
- permanently stored locally in the form of key value pairs
- multiple pages can be shared
save
localStorage.setItem("<key>","<value>")
get
localStorage,getItem("<key>")
revise
localStorage.setItem("<key>")
strore complex data types
JSON.tsringify(<complex data>)
convert complex data types to json for storage
reverce
JSON.parse(<JSON string>)
sessionstorage
- The lifecycle to close tthe browser
- the same page can be shared
other are the same as localstorage
get all keys
Object.keys(<object name>)
Returned is an array
get all values
Object.values(<object name>)
Returned is an array
add object
Object.assign(<new>,<old>)