Declare a variable to export later on in JavaScript

Let's assume that you declare a variable to export later on:

javascript
let friends = 30;

export { friends };

This is equivalent to:

javascript
export let friends = 30;

Now you can import the variable such as:

javascript
import { friends } from '../Friends.js';

console.log(friends); // 30

Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.