object

object

timer

intermittent

open
TEXT
1
let <timer name> =setInterval(<function name>,<time(ms)>)
TEXT
1
let <timer name> =setInterval(function(){},<time(ms)>)

return is id number

clear
TEXT
1
clearInterval(<timer name>)

delayed

open delayed
TEXT
1
let <timer name> =setTimeout(<function name>,<time(ms)>)

clear

TEXT
1
clearTimeout(<timer name>)

this object

TEXT
1
this

when a function is passed to another function call

Change direction

  1. call

    Call a function and change this to point to

    TEXT
    1
    <function>.call(<thisArg>,<arg1>,<arg2>,...)
    • thisArg:The specified ‘this’ points to
    • arg1,arg2:Transferred parameters
  2. apply

    Call a function and change this to point to

    TEXT
    1
    <function>.apply(<thisArg>,[<argsArray>])
    • thisArg:The specified ‘this’ points to
    • <argsArray>:The parameters passed must be included in the array
  3. bind

    Will not call a function but will change it to point to

    TEXT
    1
    <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

TEXT
1
<DOM>.getBoundingClientRect()

windows

TEXT
1
2
3
4
5
6
- windows
    - navigator
    - loctation
    - document
    - history
    - screen

location

TEXT
1
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

TEXT
1
navigator

browser related information

history

TEXT
1
history

history and address bar operations

history function

  • forward
  • back
  • go(<number>):positive number forward,negative number backward

storage

localstorage

TEXT
1
localStorage
  1. permanently stored locally in the form of key value pairs
  2. multiple pages can be shared
save
TEXT
1
localStorage.setItem("<key>","<value>")
get
TEXT
1
localStorage,getItem("<key>")
revise
TEXT
1
localStorage.setItem("<key>")
strore complex data types
TEXT
1
JSON.tsringify(<complex data>)

convert complex data types to json for storage

reverce
TEXT
1
JSON.parse(<JSON string>)

sessionstorage

  1. The lifecycle to close tthe browser
  2. the same page can be shared

other are the same as localstorage

get all keys

TEXT
1
Object.keys(<object name>)

Returned is an array

get all values

TEXT
1
Object.values(<object name>)

Returned is an array

add object

TEXT
1
Object.assign(<new>,<old>)