why am I getting javascript error: use strict: not found and Syntax error: word unexpected (expecting ")")

313 Views Asked by At

Compiling Script files using npm start, getting errors: use strict: not found Syntax error: "(" unexpected or Syntax error: word unexpected (expecting ")")

Here is my code, index.js:

"use strict";
const getBtnEvent = document.querySelector("button");
getBtnEvent === null || getBtnEvent === void 0 ? void 0 : getBtnEvent.addEventListener('click', () => {
    console.log('Clicked the button' + getBtnEvent);
});
//# sourceMappingURL=index.js.map

I've been using ES6 for above code and node version 18.*

checked for javascript version, npm start file, npm dependencies

0

There are 0 best solutions below