Javascript trying to write function to increment and return second number for every amount of 25 past set amount of first number


I have a word count function that returns the number of words in a string.

Now I’m trying to add to that function to count, by increments of 25, how many words over 50 there are then increase a second number based on that outcome, but I’m stumped on how to set that second number

const setHeight = (bodyText) => {
  bodyText = bodyText.replace(/(^s*)|(s*$)/gi,"");
  bodyText = bodyText.replace(/[ ]{2,}/gi," ");
  bodyText = bodyText.replace(/n /,"n");

  let bodyTextLength = bodyText.split(' ').length;

  let height = 400;

  // Not sure how to accomplish the counting here, added pseudo code for context

  for(let i = 50; bodyLength > i; i++){
    ...let height = number

  return height

Source: Ask Javascript Questions