3.21

3.21 Study diary

The Storage interface is used to store user-defined information in the browser client

LocalStorage, SessionStorage, and GlobalStorage are its three storage forms. We mainly learn LocalStorage.

Interface methods of LocalStorage:

  1. localStorage.setItem(key, value): Used to insert key-value pairs into localStorage.
  2. localStorage.getItem(key): Read the localStorage string value of key.
  3. localStorage.removeItem(key):删除localStorage中key。
  4. localStorage.clear(): Clear all keys in localStorage.
  5. It should be noted that only string type data can be stored in localStorage.
  6. key(): Get the name of the position at the specified number position.

JavaScript's native error types:

1. SyntaxError is an error that occurs while parsing the code

2. ReferenceError is an error that occurs when referring to a variable that does not exist

3. RangeError is an error that occurs when a value is outside the valid range

4. TypeError is an error that occurs when a variable or parameter is not of the expected type. For example, using the new command for primitive types such as strings, numbers, and booleans will throw this error.

5. URIError is an error thrown when the URI related function is incorrect

6. EvalError is an error thrown when the Eval function is not executed correctly


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325642984&siteId=291194637