You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// we iterate with for loop to check what's the index of the word we want to replace and what's the case of 1st letter, and then replace the input before with input after, adjusting first letter's case
for (let i = 0; i < strArr.length; i++) {
if (strArr[i] === before) {
if (isUpperCase(before)) {
delete strArr[i];
after = capitalise(after);
strArr[i] = after;
} else {
delete strArr[i];
strArr[i] = after.toLowerCase();
}
}
}
// now we make our array string again and return it