I'm trying to change the value of a property in a JavaScript object, but in object creation literally, not constructor.
var cliente = {
nome: "Wesley",
idade: 20,
cargo: "Front End",
setAtualiza : functiion(n, i, c){
this.nome = n;
this.idade = i;
this.cargo = c
}
};
setAtualiza("NovoNome", 25, "Pleno");
for(var x in cliente){
console.log(cliente[x]);
};
setAtualiza();
And the output I'd like to have is: "NewName 25 Full"
What am I doing wrong? Or this can not be done (refresh a literal object).