The use of export and import constants in Javascript

Hi, in this post we are going to see the different ways to use the import in Javascript.

We can use export for constants:

In this file we are declaring and exporting a constant:

// Constants
export const description = 'Hi, this is a description'

Then in other file we want to import the constant that we declared because we want to use it:

// Importing the constant
import { description } from '../../contexts/app'

console.log('description ***>', description)


By Cristina Rojas.