0
0
Javascriptprogramming~10 mins

Exporting values in Javascript - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to export the variable name as a named export.

Javascript
export const [1] = 'Alice';
Drag options to blanks, or click blank then click option'
Aexport
Bname
Cdefault
Dvalue
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'default' instead of the variable name
Trying to export without a variable name
2fill in blank
medium

Complete the code to export the function greet as the default export.

Javascript
export [1] function greet() { return 'Hello'; }
Drag options to blanks, or click blank then click option'
Adefault
Bnamed
Cconst
Dlet
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'named' instead of 'default'
Omitting the keyword after 'export'
3fill in blank
hard

Fix the error in the export statement to correctly export the variable age.

Javascript
const age = 30;
export [1] age;
Drag options to blanks, or click blank then click option'
A{ age }
Bconst
Cdefault
Dage
Attempts:
3 left
💡 Hint
Common Mistakes
Writing export age; without braces
Using export const age; after declaration
4fill in blank
hard

Fill both blanks to export color and size as named exports in one statement.

Javascript
const color = 'red';
const size = 'large';
export [1] [2];
Drag options to blanks, or click blank then click option'
A{
Bcolor
Csize
D}
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting the closing brace
Trying to export variables without braces
5fill in blank
hard

Fill all three blanks to export width and height as named exports and area as the default export.

Javascript
const width = 5;
const height = 10;
const area = width * height;
export [1] [2] [3];
Drag options to blanks, or click blank then click option'
A{ width, height }
Bdefault
Carea
Dconst
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to export default and named exports in one statement incorrectly
Omitting braces for named exports