Import and Export an Array using ES6 Module Syntax
Create two files
Write an array with the values as
Import the array in the
Import and Export a Boolean using Common JS Module Syntax
Create two files
Write a boolean with the value as
Import the boolean value in the
Import and Export a Function using Common JS Module Syntax
Create two files
Write a JS function that returns the
Import the function in the
.
Import and Export a Function with Parameter using Common JS Module Syntax
Create two files
,
parallel to
file.
Write a JS function that accepts a number and returns its square, in the file
and export it using the default export syntax.
Import the function in the
file.
Use Common JS module syntax
.
Import and Export Multiple Values using ES6 Module Syntax
Create two files
Write an array, object and a function that in the file
Import the values in the
.
The variable names and values are given in the below table,
Variable | Type | Description/Value |
---|---|---|
myArray | Array | ["camel", 265, true, "5.6"] |
bulb | Object | {watts: 10, type: "LED"} |
multiplyByFour | Function | Should accept a number and return a number multiplied by four |
Import and Export a Number using ES6 Module Syntax
Create two files
Write a JS program to export the number
Import the number in the
Import and Export a Number using ES6 Module Syntax
Create two files
Write a JS program to export the number
Import the number in the
Import and Export an Object using Common JS Module Syntax
Create two files
Write an object with keys as
Import the object in the
Import and Export a String using ES6 Module Syntax
Create two files
Write a string
Import the string in the
.