Below is a snippet of code from my current project:
for(i = 0; i < inputArr.length; i++) {
if(accountsBool) {
inputArr[i] = inputArr[i].split(/\s+/);
if (inputArr[i] == "" || !inputArr[i].match(/[^\s]/)) {
inputArr.splice(i,1);
}
}
}
I am facing an issue and I'll do my best to explain it...
The objective here is to remove any whitespace and empty strings within the code. However, the lines...
inputArr[i] = inputArr[i].split(/\s+/);
and...
if (inputArr[i] == "" || !inputArr[i].match(/[^\s]/)) {
inputArr.splice(i,1);
}
...do not seem to work in conjunction with each other. When both are included, I encounter the error message "Object doesn't support this property or method". Interestingly, if I comment out one of them and run the code with the other, it appears to function correctly. The syntax also appears to be correct. Any insights?
inputArr contains an array of strings that get parsed in from a text area.
Appreciate your help.