You can override methods valueOfand toString Objectarchiving.
Example:
var myObject = {
value: 5,
valueOf: function(){
return this.value;
},
toString: function() {
return 'value of this object is' + this.value;
}
};
Javascript , string /, , .
:
console.log(myObject + 10);
15
alert(myObject);
' 5'