Declare a variable to export later on in JavaScript

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

let friends = 30;

export { friends };

This is equivalent to:

export let friends = 30;

Now you can import the variable such as:

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.