Ive a class like this
class security
{
public id:number;
public name:string;
}
Then I have an array of security as follows
let s:security[]=[{id:1,name:'Alex'},{id:2,name:'John'},{id:3,name:'Philip'},{id:4,name:'Mark'},{id:5,name:'Thomas'}];
So a function if I pass the value 0, it will change all names of the array as empty string. If I pass an ID, name should change for that specific ID only.
What I tried was
var id=1;
let s2:security[]=s.find(x=>x.id==id);
Then I have to loop through s2 and change the values. But I guess for both the case rather than looping we can do that change all something like select method in linq
So how can we change object array values for all object or selected without using loop