check string matches from the given array of string in javascrpit

前端 未结 3 1695
星月不相逢
星月不相逢 2021-01-27 05:05

i trying to match my string with given array of string but this below code is not working,is any suggestion might be help , below code is what i have tried

le         


        
3条回答
  •  梦谈多话
    2021-01-27 05:49

    No need to loop

    let myLongString = 'jkjdssfhhabf.pdf&awersds=oerefsf';
    console.log(/\.(jpe?g|pdf)/i.test(myLongString));

提交回复
热议问题