EduCoder_web training homework--JavaScript learning manual five: JS array

I got up at 5:30 in the morning. I was so tired just coming home today. Just update it first! Not surprisingly, it will be all sent out in the last two days.
Although, the web exam was postponed to the next semester. But more than learning!

first round

//请在此处编写代码
    /*********begin*********/
    if(a==array1.length){
    
    
        return "hello";
    }else{
    
    
        return 2.1 ;
    }

    /*********end*********/

Second level

  //请在此处编写代码
    /*********begin*********/
    for (var i=0;i<a;i++){
    
    
testArray.unshift(testArray .pop());
}
return testArray[b];

    /*********end*********/

Third pass

//请在此处编写代码
    /*********begin*********/
    var murr = new Array(a);
    for(var i= 0;i<a;i++) {
    
    
           murr[i] = new Array(b);
        }
    var count =0;
    for(var i=0;i<a;i++){
    
    
            for(var j = 0;j<b;j++){
    
    
         murr[i][j] = arr[count];
           count++;
              }
       }
        return murr;

    /*********end*********/

Fourth level

 //请在此处编写代码
    /*********begin*********/
      var s=0;
      var a=new Array();
      while(s<myArray.length){
    
    
       s=myArray.indexOf("a",s);
       if(s!=-1){
    
    
              a.push(s);
               s++;
              }
       else{
    
    
            break;
             }
       }
           s=0;
          var b=new Array();
       while(s<myArray.length){
    
    
           s=myArray.indexOf("b",s);
           if(s!=-1){
    
    
           b.push(s);
           s++;
             }
           else{
    
    
                break;
          }
         }
            return a.concat(b);


 
    /*********end*********/

Fifth level

 //请在此处编写代码
    /*********begin*********/
           var array1 = [];
            var num=0;
          for(var i = arr.length-1;i >=0;i--) {
    
    
              n=arr[0];
              array1[num]=0;
            for(var j = 1;j <=i;j++) {
    
    //一次选择
              if(arr[j] > n) {
    
    
                   n = arr[j];
              array1[num]= j;
             }
                   } 
            var temp=arr[array1[num]];
             arr[array1[num]]=arr[i];
                  arr[i]=temp;
               num++;
               }
               array1.pop();
               return array1;

    /*********end*********/

What date do you all return home?
Hahahaha, I chose to go home today after spending a day at school yesterday.
This holiday came too suddenly.
However, I still wish you a happy holiday!
See you tomorrow!

who I am?
Two Xianqiao traffic commissioner
to China Shanxi Road resident representative of
the pineal bombs shake three-dimensional BI vaginal Master Jin
Chen e e University City sub-
skipping ten experts

earthy experts
welcome attention to my public No.
Let's discuss learning about life
in There are more resources waiting for you here.
Welcome to the online conversation!
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_45803282/article/details/112443576