Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
538 B
1
Indexable
Never
function findmaxarry(arr){
  let max=arr[0]
  for(let element of arr){
    if(element>max){
      max=element
    }
  }
  return max
}
function findmax(arry){
  let maxarry=[]
  for(let item of arry){
    maxarry.push(findmaxarry(item.notes))
  }
  return maxarry
}

const arry=[
  {
  id: 1,
  name: "Jacek",
  notes: [5, 3, 4, 2, 5, 5],
  },
  {
  id: 2,
  name: "Ewa",
  notes: [2, 3, 3, 3, 2, 5],
  },
  {
  id: 3,
  name: "Zygmunt",
  notes: [2, 2, 4, 4, 3, 3],
  },
  ]

console.log(findmax(arry))