In my Typescript code, I have the following line:
const addressFound: AddressPrimary = <AddressPrimary>(this.addressArray.find(addr => addr.id === id));
The AddressPrimary
class contains various variables such as id: number
, city: number
, and other string variables.
Once the above line executes, what will the variable addressFound
contain?
Will it store a reference to the class/data object?
I am curious about this because the method containing this line "returns (addressFound)", and at another point, I have a line
myAddress: AddressPrimary = method(id)
. When I then set myAddress.id = 7;
, the corresponding class in array addressArray
is updated so that its id property becomes 7.