Q:

How to find any number that includes a certain digit - like 1323 includes the digit "2"

Looking to replace an index in an array of numbers if that index is a number with a certain digit (say "1").  For instance, 414 has a "1" in it, so replace with text like "oops, no "1's"
I have a program to take a number as user input , and create an array that includes all the numbers up to and including the input number. I have 'if else' rules for replacing the offending single digit numbers. Not sure how to target multiple digit numbers that include a given digit.
var one = [1]
var two = [2]
var three =[3]
var userInput = $("#userInput").val();
var arr = [];
for (i=0;i<=userInput;i++) {
  arr.push(i);
  if (three.includes(arr[i])){
    arr.splice(i,1,"I'm sorry, Dave. I'm afraid I can't do that.")
  } else if (two.includes(arr[i])){
    arr.splice(i,1,"Boob!")
  } else if (one.includes(arr[i])){
    arr.splice(i,1,"Beep!")
  }
};

for numbers like 13, it should trigger the rule for numbers including 3, but instead it just displays 13 like there everything is fine.

A:

I'm learning JS and new to Stackoverflow, sorry if I'm wrong.
As you show on your comments, the first digit of userInput is important.
var userInput = 24;
var firstDigit = userInput.toString().substr(0,1);
var arr = [];
for (i = 0; i <= userInput; i++) {
  arr.push(i);
  if(firstDigit==='3') {
    if (arr[i].toString().includes('3')) {
      arr.splice(i,1,"I'm sorry, Dave. I'm afraid I can't do that.");
    }
  }
  if(firstDigit==='2') {
    if (arr[i].toString().includes('2')){
      arr.splice(i,1,"Boob!");
    }
  }
  if(firstDigit==='1') {
    if (arr[i].toString().includes('1')){
      arr.splice(i,1,"Beep!")
    }
  }
};
console.log(arr);
//[0, 1, "Boob!", 3, 4, 5, 6, 7, 8, 9, 10, 11, "Boob!", 13, 14, 15, 16, 17, 18, 19, "Boob!", "Boob!", "Boob!", "Boob!", "Boob!"]

I really hope that this is what you are looking for. Good luck!
edit:
You could do this too!
var userInput = 24;
var firstDigit = userInput.toString().substr(0,1);
var arr = [];
for (i = 0; i <= userInput; i++) {
  arr.push(i);
};
newArr = arr.map(e => e.toString().includes(firstDigit) ? 'problem' : e);
console.log(newArr);
//[0, 1, "problem", 3, 4, 5, 6, 7, 8, 9, 10, 11, "problem", 13, 14, 15, 16, 17, 18, 19, "problem", "problem", "problem", "problem", "problem"]

