title: Using JavaScript class in another .js file
body: <p>I have declare a class in a FoodItem.js file like</p>
  <pre><code>export default class FoodItem {
  
     constructor(name) {
        this.name = name;
     }
  
     methodOne() {
        //statement
     }
  
  }
  </code></pre>
  <p>And then in index.js file (same directory as FoodItem.js) I do an import like</p>
  <pre><code>import FoodItem from './FoodItem';
  </code></pre>
  <p>When I run it, I got an error</p>
  <blockquote>
  <p>Cannot use import statement outside a module.</p>
  </blockquote>
  <p>Can anyone tell what is wrong with the export/import syntax?</p>