I have object like this :
var item = {
A : 3,
B : 4,
C : parseInt(A*B)
}
I want to perform multiplication, C = A*B , i have tried to do multiplication as specfied in above object but did not work . How can i do that . Please help me
I have object like this :
var item = {
A : 3,
B : 4,
C : parseInt(A*B)
}
I want to perform multiplication, C = A*B , i have tried to do multiplication as specfied in above object but did not work . How can i do that . Please help me
You could reach the desired result with a simple function.
var item = {
A : 3,
B : 4,
C : function() {
return this.A * this.B;
}
}
console.log(item.C());