调用JavaScript的一个内置函数:Math.max()
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>找出多维数组最大值</title>
</head>
<body><script>const testArr = [[1,2,3],[4,5,6],[7,8,9]]function newArr(arr) {let newArr1 = []arr.forEach(item => {newArr1.push(Math.max(...item))});return newArr1}console.log(newArr(testArr))</script>
</body>
</html>