Cadastro = {
"descricao" : "Novo usuário",
"editando" : false
}
Is it possible at runtime to get the property value "editing" and use it?
Something like:
Cadastro = {
"descricao" : "Novo usuário",
"editando" : false,
"titulo" : "editando" ? "Editar" : "Criar"
}
I have found a way but it is not using the property but creating a variable in the global scope:
window.editando = true;
Cadastro = {
"descricao" : "Novo usuário",
"editando" : false,
"titulo" : (window.editando ? "Editar" : "Novo")
}
Is there any other way to do this? What I want is when the value of the variable change the value of the return "title" also changes.