JS Calculator Project failing please help

Hi! I’ve been making this code since a couple days i tried it and it seems to work fine it makes the calculations and brings the result, but when i run the tests, the page becomes slow and finally returns an error, i don’t know what is happening, please if someone could help me would be of great help, thank you!

You’re obviously running into an infinite loop with your managingLogic function:

managingLogic(arr){
    if(arr[0] === ''){
      arr.shift();
    }
    
    var results = arr.shift();
    while(arr.length > 1){
      switch(arr[0]){
        case '+':
          results += arr[1];
          arr.splice(1, 2);
        case '-':
          results -= arr[1];
          arr.splice(1, 2);
        case '*':
          results *= arr[1];
          arr.splice(1, 2);
        case '/':
          results /= arr[1];
          arr.splice(1, 2);
      }
    }
    
    return results;
  }

It works fine for calculations with single digit numbers like 9/3 or 8/2, but when I try to calculate 10/2 and log the array on each loop, its always ["0", 0, "/", 2], so its length will always be > 1 and the loop will never stop. I’m not exactly sure what you’re doing with your functions and it’s a little annoying to debug because my browser keeps crashing, but maybe that’ll give you a hint.

Thank you for your feedback! i will check my code!