use

use

use

Function

use is used to import fields in the object into the current scope, suitable for deconstructing configuration objects, request contexts or module return objects.

Syntax

Parameters

  • object: Object, required
The object whose fields are to be imported.
  • fields: Identifier, optional
Specify the field names to be imported; when the field list is omitted, all fields are imported.

Example

Notes

  • use imports object fields, not file module systems.
  • The imported field name will be written into the current scope as a variable name. It must comply with the variable naming rules and cannot start with a capital letter.
  • Full import should avoid overwriting important variable names that already exist in the current scope.