Challenges • Asked over 3 years ago by yorkcook13
I can't figure out why my code doesn't work. It works when I try it in repl.it, is it because it doesn't make the time constraint?? Thanks!
function isDollarDeleteEqual(arr) {
let mapped = arr.map(item => getFinalStr(item));
return mapped.every(item => item === mapped[0]);
}
function getFinalStr(str) {
let arr = str.split('');
for(i =0; i < arr.length; i++) {
if(arr[i] === '$') {
arr.splice(i-1, 2);
}
}
return arr.join('');
}
Thanks!