Soru Geçmişi
«« Soruya geri dön
18.08.22 22:08
Bir array yapılan değişiklikle diğer array değiştirmek
1. arrayimde olan işlemler neden 2. arrayimde olmuyo yardımcı olursanız sevinirim. Neden olmadığını da açıklarsanız sevinirim. <!DOCTYPE html>
<html>
   <head>
      <title>deneme </title>
      <style> body{ background-color:#202124;color: white;}</style>
   </head>
   <body>
      <h2>JavaScript Array Sort</h2>
      <p>Sort the array in descending order:</p>
      <p id="demo1"></p>
      <p id="demo2"></p>
      <p id="demo3"></p>
      <p id="demo4"></p>
      <p id="demo5"></p>
      <script>
         const points = [40, 100, 1, 5, 25, 10];
         const countries=["English","Russian","German","French","Spanish","Arabic"]
         document.getElementById("demo1").innerHTML = points;
         document.getElementById("demo5").innerHTML = countries;
         points.sort(function(a, b){return b - a});
         document.getElementById("demo2").innerHTML = points;
         
         const temp=[0]
         let dur
         for(let a=0;a<6;a++){
             for(let b=0;b<6;b++){
                 if(points[a]>points[b]){
                  temp[0]=points[a]
                  points[a]=points[b]
                  points[b]=temp[0]
                  
                  dur=countries[a]
                     countries[a]=countries[b]
                     countries[b]=dur
                 }
             }}
         
         document.getElementById("demo3").innerHTML = points;
         document.getElementById("demo4").innerHTML =countries
      </script>
   </body>
</html>
Ekleyen: misafir
Değiştiren: cevapsitesi
18.08.22 22:08
Bir array yapılan değişiklikle diğer array değiştirmek
1. arrayimde olan işlemler neden 2. arrayimde olmuyo yardımcı olursanız sevinirim. Neden olmadığını da açıklarsanız sevinirim. <!DOCTYPE html>
<html>
   <head>
      <title>deneme </title>
      <style> body{ background-color:#202124;color: white;}</style>
   </head>
   <body>
      <h2>JavaScript Array Sort</h2>
      <p>Sort the array in descending order:</p>
      <p id="demo1"></p>
      <p id="demo2"></p>
      <p id="demo3"></p>
      <p id="demo4"></p>
      <p id="demo5"></p>
      <script>
         const points = [40, 100, 1, 5, 25, 10];
         const countries=["English","Russian","German","French","Spanish","Arabic"]
         document.getElementById("demo1").innerHTML = points;
         document.getElementById("demo5").innerHTML = countries;
         points.sort(function(a, b){return b - a});
         document.getElementById("demo2").innerHTML = points;
         
         const temp=[0]
         let dur
         for(let a=0;a<6;a++){
             for(let b=0;b<6;b++){
                 if(points[a]>points[b]){
                  temp[0]=points[a]
                  points[a]=points[b]
                  points[b]=temp[0]
                  
                  dur=countries[a]
                     countries[a]=countries[b]
                     countries[b]=dur
                 }
             }}
         
         document.getElementById("demo3").innerHTML = points;
         document.getElementById("demo4").innerHTML =countries
      </script>
   </body>
</html>
Ekleyen: misafir
Değiştiren: cevapsitesi
24.07.22 07:06
bir array yapılan değişiklikle diğer array değiştirmek
1. arrayimde olan işlemler neden 2. arrayimde olmuyo yardımcı olursanız sevinirim. nedn olmadığını da açıklarsanız sevinirim. <! DOCTYPE html > < html >     < head >< title >deneme </ title >< style >  body {  background-color : #202124 ; color :  white ;}</ style ></ head >     < body > < h2 >JavaScript Array Sort</ h2 > < p >Sort the array in descending order:</ p > < p id = "demo1" ></ p > < p id = "demo2" ></ p > < p id = "demo3" ></ p > < p id = "demo4" ></ p > < p id = "demo5" ></ p > < script > const points =  [ 40 ,  100 ,  1 ,  5 ,  25 ,  10 ]; const countries = [ "English" , "Russian" , "German" , "French" , "Spanish" , "Arabic" ] document . getElementById ( "demo1" ). innerHTML = points ; document . getElementById ( "demo5" ). innerHTML = countries ; points . sort ( function ( a ,  b ){ return b - a }); document . getElementById ( "demo2" ). innerHTML = points ; const temp = [ 0 ] let  dur for ( let  a = 0 ;a < 6 ;a ++ ){      for ( let  b = 0 ;b < 6 ;b ++ ){          if ( points [a] > points [b]){           temp [ 0 ] = points [a]           points [a] = points [b]           points [b] = temp [ 0 ]                    dur = countries [a]              countries [a] = countries [b]              countries [b] = dur         }     }} document . getElementById ( "demo3" ). innerHTML = points ; document . getElementById ( "demo4" ). innerHTML = countries </ script > </ body > </ html >
Ekleyen: misafir
 
En fazla 3 eski durum gösterilir.