1
I am trying to change the value of a property in a Javascript object, but in the creation of the object literally, and 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 exit I’d like to have is: "Novonome 25 Full"
What am I doing wrong? Or is it not possible to do (update a literal object).
Where the setAtualize function?
– Felipe Avelar