Regex check for match, and set truth value

I am trying to do something rather simple I believe, but I am new to Javascript, and am not sure what function I should be using. I want to check an incoming string agaist a regex to find if matches and if it does then set a bool true else false. Here is what I tried:

 function screenCapture(value)
  {
    let regex = /\.(gif|jpe?g|tiff?|png|webp|bmp)$/i;
    const found = value.match(regex);
    if(!found)
    {
      var str1 = ".png";
      value.concat(str1);
    }
  }

How do I use Boolean here to help me?

you use the test method that returns a boolean

or you need to look at what the match method returns as that returns an array, or something else when there is no match

try to add console.log(found), what do you have there?

issue number two: concat returns a new string

@ieahleen Hey thanks, okay this seems to be working:

let regex = /\.(gif|jpe?g|tiff?|png|webp|bmp)$/i;
    var found = regex.test(value);

    if(!found)
    {
      var str1 = ".png";
      value = value.concat(str1);
    }

note that if you need the file extension to do something else in your code is fine to use match (it should return null I think if there is no match - so your check will work the same)