2018-10-12 15:37:13 -04:00
|
|
|
---
|
|
|
|
title: Use export to Reuse a Code Block
|
|
|
|
---
|
2019-07-24 00:59:27 -07:00
|
|
|
# Use export to Reuse a Code Block
|
2018-10-12 15:37:13 -04:00
|
|
|
|
2019-07-24 00:59:27 -07:00
|
|
|
---
|
|
|
|
## Problem Explanation
|
2018-10-12 15:37:13 -04:00
|
|
|
We learned how to import stuff from another file. But there's a catch. You can only import files that are **exported** from that other file.
|
|
|
|
|
|
|
|
Your task here is to export `foo` and `bar`.
|
|
|
|
|
2019-07-24 00:59:27 -07:00
|
|
|
|
|
|
|
---
|
|
|
|
## Hints
|
|
|
|
|
|
|
|
### Hint 1
|
2018-10-12 15:37:13 -04:00
|
|
|
|
|
|
|
Just add export in front of them!
|
|
|
|
|
|
|
|
|
2019-07-24 00:59:27 -07:00
|
|
|
---
|
|
|
|
## Solutions
|
|
|
|
|
|
|
|
<details><summary>Solution 1 (Click to Show/Hide)</summary>
|
2018-10-12 15:37:13 -04:00
|
|
|
|
|
|
|
```javascript
|
|
|
|
"use strict";
|
|
|
|
export const foo = "bar";
|
|
|
|
export const bar = "foo";
|
|
|
|
```
|
2019-07-24 00:59:27 -07:00
|
|
|
</details>
|