• task Brackets

Question related to mission Brackets

 

Why my solution got Error: 12,37: ')' expected. function should return True or False ? I ran this function in browser with your examples and all works

function brackets(expr: string): boolean {

let d = expr.replace(/([+=/*-])/g, '').replace(/[0-9]/g, '');

while(d.includes('[]') || d.includes('{}') || d.includes('()')){
    d = d.replace('()', '').replace('{}', '').replace('[]', '');
}

return d == ''; }