remove spaces from strings in array [duplicate]

I’m not sure if there is a more simpler way, but I am trying to create a function that loops through an array of strings and removes any space found.

This code manages to print out “00”, “11” and “22” correctly but the last loop prints “undefined” if I use i < as opposed to i <=.

When I added i <= stringArr[i].length, although it now prints “33”, I get an error saying:

**Uncaught TypeError: Cannot read properties of undefined (reading 'length') at removeSpaces**
const spacesArr = ["0 0", "1 1", "2 2", "3 3"];

const removeSpaces = stringArr => {
    for (let i = 0; i <= stringArr[i].length; i++) {
        console.log(stringArr[i].replace(/ /g, ''));
    }
}

I’m quite new to coding. Be gentle XD