here is the deal
if(!userExist) {
userJson["user"] = [{"name": msg.author.username, "commands": { userCommand : userCommandValue }}]
}
edit: to avoid confusion, this is my userCommand :
let userCommand = msg.content;
userCommand is considered like a property and not like a variable existing...
Is there a way to bypass that ?
CodePudding user response:
As of ES6, your can do this: wrap a []
arount userCommand
if(!userExist) {
userJson["user"] = [{"name": msg.author.username, "commands": { [userCommand] : userCommandValue }}]
}