Quote the keys, like this:
var keyObject = {
"public" : {
iv: "123",
key: "123"
},
"private" : {
key: "123"
}
}
Domanda
How can I create an object like this in JS since public and private are reserved words
keyObject = {
public : {
iv: "123",
key: "123"
},
private : {
key: "123"
}
}
Soluzione
Quote the keys, like this:
var keyObject = {
"public" : {
iv: "123",
key: "123"
},
"private" : {
key: "123"
}
}
Altri suggerimenti
you can define keys as strings
keyObject {
'public': {
iv: "123",
key: "123"
},
'private': {
key: "123"
}
}