Ich möchte einen Schlüssel Wert Objekte in konstanten Datei zu deklarieren und dann importieren. Also, das ist, was ich schrieb:Definieren von Konstanten in express.js
let ACCEPTABLE_LANGUAGES =
[
'eng' : {'wahid'},
];
export default {
ACCEPTABLE_LANGUAGES : ACCEPTABLE_LANGUAGES
}
ich es bin importieren: import common_constants from '../common_constants';
und wie folgt verwendet:
console.log(common_constants.ACCEPTABLE_LANGUAGES);
Aber die Erklärung von ACCEPTABLE_LANGUAGES
gibt mir Fehler wie:
Unexpected token, expected : (3:18)
1 | let ACCEPTABLE_LANGUAGES =
2 | [
> 3 | 'eng' : {'wahid'},
| ^
4 | ];
Ich möchte es Objekt nicht Array machen. Warum bekomme ich das Problem?
Sie müssen Arraysymbole ('[]') mit Objektsymbolen ('{}') austauschen und umgekehrt – lumio