Js judges whether Chinese characters appear in the range and how to write them.

provincelist(newVal){
        var eidtCty = window.localStorage.citycode;
        var newCty = JSON.stringify(eidtCty.substring(0,eidtCty.length-1));
        newVal.forEach((v,i)=>{
          var forCty = JSON.stringify(v.provinceName)
          if(forCty.indexOf(newCty) != -1){
            console.log(123)
            /* this.isdialog = true;
            this.alertarea() */
          }
        })
      }

forCty is
"Beijing"
"Hebei"
"Shanghai"
"Shandong"
newCty is
"Beijing"

the demand is that the city in newCty performs the operation if it is not within the scope of forCty, and if it does not perform the operation within the scope, how to judge the boss for help

Jun.15,2022

just change "! =-1" to "=-1", if you read it correctly.

if(forCty.indexOf(newCty) == -1){
            console.log(123)
            /* this.isdialog = true;
            this.alertarea() */
          }

besides indexOf, you can also use inculdes

if (forCty.includes(newCty)) {
  // ...
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b40b7e-2c52c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b40b7e-2c52c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?