My FeedDiscussionsHeadless CMS
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Modules in JavaScript confusion

Default profile photo
·Mar 29, 2018

I am simply trying to execute below javascript code ,involving the concept of module but getting unexpected error .

I am referring modules in javascript of code academy and in codecademy platform , code is running successfully .

// index.html

<!doctype html>

        <title>Page Title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="initial-scale=1.0">


<script src="abc.js"></script>
<script src="abcd.js"></script>


// abc.js

let Airplane = {};

Airplane.myAirplane = "StarJet";

module.exports = Airplane;

// abcd.js 

const Airplane = require('./abc.js');

function displayAirplane() {