Hello,
I have a situation where I need to import a JavaScript file, but the file also has a 'use strict'
line. I was wondering whether the import should come first, or if 'use strict'
should be the first line. I looked this up on Google but couldn’t find any examples.
import AnchorJS from './anchor'; <--- this
"use strict"; <--- and this
// Menu
const menuToggleBtn = document.querySelector(".menu-toggle");
menuToggleBtn.addEventListener("click", event => {
event.preventDefault();
menuToggleBtn.parentElement.classList.toggle("open");
});
document.addEventListener('DOMContentLoaded', () => {
const anchors = new AnchorJS();
anchors.add('.blog-post h3');
anchors.add('.blog-post h4');
anchors.add('.blog-post h5');
anchors.add('.blog-post h6');
});