JavaScript modules

<head>
    <script src="../js/constants.js" type="module"></script>
    <script src="../js/script.js" type="module"></script>
</head>

constants.js

export const projects = [
  "Project-A",
  "Project-B",
  "Project-C",
];

script.js

import {projects} from "./constants.js";