ExamGecko
Question list
Search
Search

List of questions

Search

Question 222 - Certified B2B Commerce Administrator discussion

Report
Export

What are two considerations to keep in mind when including additional JavaScript files in a Lightning web component?

A.
Each additional file needs a corresponding .js-meta.xml file.
Answers
A.
Each additional file needs a corresponding .js-meta.xml file.
B.
The files must be ES6 modules and must have names that are unique within the component's folder.
Answers
B.
The files must be ES6 modules and must have names that are unique within the component's folder.
C.
A module can export named functions or variables
Answers
C.
A module can export named functions or variables
D.
Additional JavaScript files should be minified before deployment
Answers
D.
Additional JavaScript files should be minified before deployment
Suggested answer: B, C

Explanation:

When including additional JavaScript files in a Lightning web component, the developer should keep in mind the following considerations:

The files must be ES6 modules and must have names that are unique within the component's folder. This is because the files are imported by their relative path, and the file name becomes the module name. The files must also use the export and import keywords to expose or consume functionality from other modules.

A module can export named functions or variables that can be imported by other modules. The developer can use the export keyword to specify what to expose from a module, and the import keyword to specify what to consume from another module. The developer can also use the default keyword to export or import a single value from a module.Reference:

Import JavaScript Files into Lightning Web Components

JavaScript Modules

asked 23/09/2024
Maheshkumar Karuppaiah
34 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first