• Task 9[BDWS] [JS]

    var bool = true;

    while(bool){
        console.log("Less is more!");
        bool = false;
    }
    in ra :
    Less is more!
    false
    ========================================================
    var count = 3 ;
    var loop = function(){
          while(count>0){
          console.log("i'm coding");
      count--;
      }
    };
    loop();
       
       in ra 3 dòng i'm coding
    =====================================================

    var bool = true;
    var soloLoop=function(){
        while(bool){
            console.log("lặp 1 lần!");
            bool = false;
        }
    };
    soloLoop();
    =====================================================
    // Write your code below!
    for(var i = 0; i < 10 ; i++){
        console.log(i);
    }
    var bool = true;
    while(bool){
        console.log("kmkmk");
        bool = false;
        }

    var bool = false;
    do{
        console.log("do while");
    }while(bool);

    1 số vd for,while, do while
    ==========================================================
     tìm kiếm kí tự nào :)

     var text="nguyen ngoc minh";
     var myName="minh";
     var bits = [];
     for( var i = 0 ; i < text.length ; i++)
     {
        if(myName[0] === text[i])
    {
      for( var j = i ; j < myName.length+i ; j++)
         {
        hits.push(text[j]);
    console.log(hits);
    }
    }
    }
    if(hits.length === 0)
    {
      console.log("khong tim thay");
      }
    else
    {
        consle.log(hits);
    }
     
     
    nó sẽ in ra 'm'
                'm','i'
                'm','i','n'
    'm','i','n','h'
  • 0 nhận xét:

    Đăng nhận xét

    QUOTE & QUOTE

    Without requirements or design, programming is just the art of adding bugs to a blank text file.

    ADDRESS

    100000, My Dinh, Ha Noi, VN

    EMAIL

    minhbu883@mail.com
    minhnn17@fsoft.com.vn

    TELEPHONE

    +84964 214 883

    MOBILE

    +8438 5689 888