can someone help me with the following:

You are given an array of integers, and your task is to write a JavaScript function to find the maximum sum of a subarray within that array. Your function should take the array as input and return the maximum sum.

Example input: [1, 2, -3, 4, -1, 2, 1, -5, 4]

Example output: 7 (The maximum sum subarray is [4, -1, 2, 1])

Write a JavaScript function that solves the problem described above. You can use any JavaScript framework or libraries you’re familiar with if necessary.