The objects I use on the client side need a unique ID. My array of objects is very small, commonly 4 items, not more.
I use this:
export class MyItem {
uniqueObjectIdentifier: number;
constructor(obj) {
this.uniqueObjectIdentifier = Math.random();
}
}
Is there something maybe javascript or angular internal that I can access instead of the handcrafted property?
angular,typescript, orecmascript-6, but is this the same question as this?Math.random()?Math.random()is not unique. In javascript it's actually pseudo random, so it will repeat itself eventually.