1
var Mensagem = function(opcoes){
var padrao = {
titutlo: "",
msg: "",
lido: false
}
var config = $.extend(padrao, opcoes);
this.prototype = config;
}
var msg = new Mensagem({
titulo: "Olá mundo!",
msg : "Testando..."
});
console.info("Retorno:");
console.log(msg);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
Retorno no console
I wanted this code to return
{ title:"value", msg: "value", read: "value" }
but is returning
{
prototype:{ titulo:"valor", msg: "valor", lido: "valor" }
}
What I’m doing wrong?
It happens mate, sometimes we’re so sure we did it right, that a comma kills our code kkk It’s best to cool your head and stir afterwards.
– user28595