Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to export the function named greet.
Typescript
export [1] function greet() { console.log('Hello!'); }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable declaration keywords like const or let instead of default.
Forgetting to add export keyword.
✗ Incorrect
Using export default exports the function as the default export of the module.
2fill in blank
mediumComplete the code to export multiple named constants.
Typescript
export const [1] = 42, pi = 3.14;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using reserved words or invalid variable names.
Forgetting to use const keyword.
✗ Incorrect
We export the constant named answer along with pi.
3fill in blank
hardFix the error in the export statement for a type alias.
Typescript
export [1] User = { name: string; age: number }; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using const or class keywords for type aliases.
Confusing interface with type alias.
✗ Incorrect
Type aliases use the type keyword to define a new type.
4fill in blank
hardFill both blanks to export a function and a variable together.
Typescript
export { [1], [2] }; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using names that are not declared in the module.
Forgetting commas between names.
✗ Incorrect
This syntax exports the named items greet and answer together.
5fill in blank
hardFill all three blanks to re-export named exports from another module.
Typescript
export { [1], [2] as alias, [3] } from './module'; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using invalid names not exported by the other module.
Misplacing the
as keyword.✗ Incorrect
This re-exports qux, renames bar to alias, and re-exports foo from another module.