I have an array with one column n_fnc and I would like to find the max value . I tried with this but I don"t get anything.
let first = this.fncs.map(item => item.n_fnc);
console.log("First",first);
x= Math.max(...first);
[
fnc service
getlastid(response,fncs:Fnc[]):void{
let fnc:Fnc;
response.forEach(element => {
fnc =new Fnc();
fnc.n_fnc=element.n_fnc;
fncs.push(fnc);
});
Fnc component.ts
this.fncs=[];
this.fncservice.obs.subscribe((response)=>this.fncservice.getlastid(response,this.fncs));
console.log("A",this.fncs);
var max= Math.max.apply(Math, this.fncs.map((m) => m.n_fnc));
console.log("Max",max);