Switch case statement with array index as value

I have the followng issue with switch case statement. I have a variable named combineDirection with a changing index value each time a user types a value in the input field. The switch statement is supposed to match index of variable to case value and then slice arrays mentioned in firstRow, secondRow and thirdRow accordingly. I cannot seem to return the correct concatenation of array’s and there given indexes . The variable testVal is a number a user inputs that could be 1 or up to number 9. Stored in the firstRow , secondRow and thirdRow variables. Here is my code. Thanks in advance for youre advice with this issue.

let testVal  = 1;//Can be any number between 1 and 9.
let multiArray = [
  [ '..9..5.1.' ],
  [ '85.4....2' ],
  [ '432......' ],
  [ '1...69.83' ],
  [ '.9.....6.' ],
  [ '62.71...9' ],
  [ '......194' ],
  [ '5....4.37' ],
  [ '.4.3..6..' ]
];
let flagMe = true;
let combinedDirection = multiArray[0][0][0];//variable with array index keeps changing with user input.
 switch(combinedDirection){
     case  multiArray[0][0][0]:
     case  multiArray[0][0][1]:
     case  multiArray[0][0][2]:
     case  multiArray[1][0][0]:
     case  multiArray[1][0][1]:
     case  multiArray[1][0][2]:
     case  multiArray[2][0][0]:
     case  multiArray[2][0][1]:
     case  multiArray[2][0][2]:
     firstRow  = multiArray[0][0].slice(0,3);
     secondRow = multiArray[1][0].slice(0,3);
     thirdRow  = multiArray[2][0].slice(0,3);
     break;
     case  multiArray[0][0][3]:
     case  multiArray[0][0][4]:
     case  multiArray[0][0][5]:
     case  multiArray[1][0][3]:
     case  multiArray[1][0][4]:
     case  multiArray[1][0][5]:
     case  multiArray[2][0][3]:
     case  multiArray[2][0][4]:
     case  multiArray[2][0][5]:
     firstRow  = multiArray[0][0].slice(3,6);
     secondRow = multiArray[1][0].slice(3,6);
     thirdRow  = multiArray[2][0].slice(3,6);
     break;
     case  multiArray[0][0][6]:
     case  multiArray[0][0][7]:
     case  multiArray[0][0][8]:
     case  multiArray[1][0][6]:
     case  multiArray[1][0][7]:
     case  multiArray[1][0][8]:
     case  multiArray[2][0][6]:
     case  multiArray[2][0][7]:
     case  multiArray[2][0][8]:
     firstRow  = multiArray[0][0].slice(6,9);
     secondRow = multiArray[1][0].slice(6,9);
     thirdRow  = multiArray[2][0].slice(6,9);
   }
   combineMe = [...firstRow,...secondRow,...thirdRow];
   console.log(combineMe);
   [...combineMe].forEach((el,index)=>{
      if(el == testVal){
        flagMe = false
      }
   })

Could you pull up a codepen or something of the sort. Also the code you have written is not very readable which makes it exponentially harder to both work on and get help on.

Also, I don’t really understand the question, can you give an example for a certain input, and which output you’d like for that?

Sorry i tried to make a shorter version of the freecodecamp sudoku solver checkRegion function.
Here is the full project link the function can be found in the controller/sudoku-solver.js
file Thank you .
sudoku solver current version

Hmm, I have not worked on this project, nor am I that familiar with the game, but my friend did do something similar and he found

these to be useful. This would require you to change your implementation, but the learning experience would worth it.

Thanks i found my own way to solve this issue with backtracking algorithm found online.For any one having issuses with the code please check out these links

backtraking algorithm
I build a Sudoku Solver Article by MegacolorBoy

:laughing: