How can I correctly check if a string does NOT contain a specific word?

前端 未结 6 1200
一个人的身影
一个人的身影 2021-01-11 15:01

I am currently trying to figure out how to solve the above named problem. Specifically I want to check if the string does not contain the word \"stream\" both in ca

6条回答
  •  伪装坚强ぢ
    2021-01-11 15:17

    Thanks for the fast feedback guys, the code is now running perfectly fine!

    I am using the following code:

    `if      (gewaesser_name1.toLowerCase().indexOf("stream") === -1 && gewaesser_name2.toLowerCase().indexOf("stream") === -1) 
             {var a = "does NOT contain stream"}
    
     else    {var a= "does contain stream"}
    

    `

提交回复
热议问题