performance – Is this function “in place” and O(1) space and O(n) time?

function reverseWords(message) {
  const max = message.length;
  let n = max;
  let wordLen = 0;
  for (let i = 0; i < max; i += 1) {
    if (message(i) === " ") {
      n -= wordLen;
      wordLen = 0;
      message.splice(max - wordLen, 0, " ");
    } else {
      message.splice(n, 0, message(i));
      wordLen += 1;
      n += 1;
    }
  }
  message.splice(0, max);
}

//==========================================================================
/*Test cases using Jasmine (see https://github.com/jasmine/jasmine and https://jasmine.github.io/pages/docs_home.html):
describe("main tests, but showing just one for brevity", function () {

  it("rearranges correctly", function () {
    const message = (
      "m",
      "e",
      "s",
      "s",
      "a",
      "g",
      "e",
      " ",
      "t",
      "h",
      "e",
      " ",
      "i",
      "s",
      " ",
      "h",
      "e",
      "r",
      "e"
    );

    reverseWords(message);
    expect(message.join("")).toEqual("here is the message");
  });
});*/

const message = (
      "m",
      "e",
      "s",
      "s",
      "a",
      "g",
      "e",
      " ",
      "t",
      "h",
      "e",
      " ",
      "i",
      "s",
      " ",
      "h",
      "e",
      "r",
      "e"
    );

    reverseWords(message);
    console.log(message.join(""));