-3
let carryData = {
prova: Number(34),
semanal:Number(345),
aExtra:Number(543),
total:??? //quero o valor da prova, nesse mesmo objeto
}
-3
let carryData = {
prova: Number(34),
semanal:Number(345),
aExtra:Number(543),
total:??? //quero o valor da prova, nesse mesmo objeto
}
1
If you want to declare ownership total
with the same value, you will have to double the value assigned to prova
.
Now if total
is only a property to access the value, you can declare it as a getter.
let carryData = {
prova: 34,
semanal: 345,
aExtra: 543,
get total() {
return this.prova;
}
};
console.log(carryData.total);
Browser other questions tagged javascript
You are not signed in. Login or sign up in order to post.