//using object type
let p = {
x: 1, y: 2,
'toText': function() {
return "x = " + this.x +
"; y = " + this.y
},
'move': function(right: number, down: number) {
this.x += right
this.y += down
}
};
let str1 = p.toText()
//str1 is "x = 1; y = 2"
p.move(5, -1)
let str2 = p.toText()
//str2 is "x = 6; y = 1"
console.log(`str1 is "${str1}"`)
console.log(`str2 is "${str2}"`)