Why is my roman numeral converter not working?

Okay basically I made some switch/case statements that push a numeral into an array that i’ll eventually join but the array is returning empty. I know there’s a better way to do this but I genuinely can’t figure it out. Any help would be appreciated.

function convertToRoman(num) {
  let romanArr = [];
  let regex = /\d/g
  let numArr = "".concat(num).match(regex)
  numArr = numArr.map((num) => parseInt(num))

  while (numArr.length < 4) {
    numArr.unshift(0)
  }
  for (let i = 0; i < numArr.length; i++) {
    let number = numArr[i] * 10 ** (i + 1)
    switch (number) {
      case 0 < number < 10000:
        romanArr.push("M" * (number / 1000))
      case 0 < number < 1000:
        switch (number) {
          case number === 900:
            romanArr.push("CM")
          case number === 400:
            romanArr.push("CD")
          case 400 < number <= 800:
            romanArr.push("D".concat("C" * (number / 100) - 5))
          case number < 400:
            romanArr.push("C" * (number / 100))
        }
      case 0 < number < 100:
        switch (number) {
          case number === 90:
            romanArr.push("XC")
          case number === 40:
            romanArr.push("XL")
          case 40 < number <= 80:
            romanArr.push("L" + ("X" * (number / 10) - 5))
          case number < 40:
            romanArr.push("X" * number)
        }
      case 0 < number <= 9:
        switch (number) {
          case number === 9:
            romanArr.push("IX")
          case number === 4:
            romanArr.push("IV")
          case number < 4:
            romanArr.push("I" * number)
          case 4 < number <= 8:
            romanArr.push("V" + ("I" * (number - 5)))
        }
    }
  }
  return romanArr

}
convertToRoman(500)
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36 Edg/103.0.1264.37

Challenge: Roman Numeral Converter

Link to the challenge:

Part of the problem appears to be that you are not understanding how to use switch here.

switch (number) {

For example, the first switch statement is shown above. In the first case condition (below), you are basically asking if number is equal to the expression 0 < number < 10000. The expression will evaluate to true or false and not a number. None of your case expressions are going to evaluate to number so nothing gets pushed to romanArr. I would stick with if and if else statements instead of using switch.

Another problem you have is trying to use * to repeat characters in a string like in the following line. The * operator used in conjunction with a string does not repeat the letters.

romanArr.push("L" + ("X" * (number / 10) - 5))

Thanks for the tips Randell! I ended up scrapping that whole thing and coming up with a much more elegant solution after taking a break for a while.