Yngvarr

Generation

generate functionWed, 16 Nov 2022

Math.max() by key

function max(numbers) { var currentMax = numbers[0]; for(var i = 0; i < numbers.length; i++) { if (numbers[i] > currentMax) { currentMax = numbers[i]; } } return currentMax; } max([1, 4, 2])

Javascript
Generate More

Questions about programming?Chat with your personal AI assistant