문자열 삭제

	   //       ,                      ,     replace
      //   :  “They are students”  ‘aeiou’
      //              “they r stdnts”
      var str1 = "They are students",
          str2 = "aeiou",
          res = '';
      
        //  :
        //                ,  indexOf(),      -1;
        //  str1      ,       str2 ,      ,     res 
       for(var i = 0; i < str1.length; i++) {
         var c = str1[i];
         if(str2.indexOf(c) < 0) {
           res += c;
         }
       } 
       console.log(res);   // //Thy r stdnts

좋은 웹페이지 즐겨찾기