I would like to keep all of error descriptions in a single .js file as a dictionary, so that I can display the appropriate description from the rest of my JavaScript web app. I am very new to JS web app development and I am wondering how to achieve this.
currently I have been trying this:
errorDesc.js:
var descriptions = {
errorCode00 : "description",
errorCode02 : "description",
errorCode03 : "description"
}
export function getResponseDescription(name) {
return descriptions[name];
}
main.js:
import {getResponseDescription} from "./errorDesc";
But in the console I get the following error: Uncaught SyntaxError: Unexpected token {