const filterString = (str, a) => {
let i = 0;
let result = str.replace(a, '');
while (i < str.length){
if (str[i] === a){
return result;
}
i++;
}
return result;
}
console.log(filterString('If I look back I am lost', 'I'));