Uncaught SyntaxError: illegal character U+2018

So I’ve been pulling my hair out trying to fix this.
If I have <script>let job=prompt("If you have a jobnumber, please enter the 8 digit jobnumber");</script> It works.

But if I have the let job… inside a .js file, I get the SyntaxERROR?

I’ve googled this with no luck.

Comments appreciated.

The prompt() method is not part of core Javascript. It is a method of the window object found in browsers. Your code will only work if it is run in a browser (e.g. in a script tag within an HTML doc).

Confused with this answer to what is prompt: In JavaScript, a prompt is a built-in function that displays a dialog box with a message and allows the user to input data. The prompt function returns the value entered by the user as a string.

Sounds like you might have copied and pasted the text, and it contains an invalid quote type.

U+2018 is a Left Single Quotation Mark which isn’t valid.

let job = prompt(‘If you have a jobnumber, please enter the 8 digit jobnumber‘);

Uncaught SyntaxError: illegal character U+2018