Community

Start a Thread


Notifications
Subscribe You’re not receiving notifications from this thread.

Can't Figure Out Why Not Working

Challenges • Asked 3 months ago by yorkcook13

yorkcook13 Commented on Mar 29, 2021:

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!