cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <div style="float:left; width:49%; border:1px dashed gray;">
	<h1>Sırasız Dizi</h1>
	<div id="sirasiz" style="">
		
	</div>
</div>
<div style="float:left; width:49%; border:1px dashed gray;">
	<h1>Adede göre sıralı dizi</h1>
	<h2 style="float:left; width:50%;">ASC</h2>
	<h2 style="float:left; width:50%;">DESC</h2>

	<div id="asc" style="float:left; width:50%;">
		
	</div>
	<div id="desc" style="float:left; width:50%;">
		
	</div>
</div>

            
          
!
            
              
			function listArray(arr,order){
			
				// dizideki tekrar eden elemanları sayı adedine toplayıp yeni obj olusturuyoruz
				var itemCount = [];
				arr.forEach(function (x) { itemCount[x] = (itemCount[x] || 0) + 1; });
				
				// olusturdugumuz objeyi ters siralamak icin diziye donusturuyoruz.
				var countsSortable = [];
				for (var i in itemCount) {
					countsSortable.push([ itemCount[i],i])
				}
						
				countsSortable.sort(function (a, b) {
					if(order === 'desc')
					{
						return b[0] - a[0];
					} else {
						return a[0] - b[0];
					}
				});
				
				return countsSortable;
					
			}
			
			var fruits = ["Karpuz","Armut","Ekşi elma","Limon","Armut","Çilek","Çilek","Karpuz","Kiraz","Greyfurt","Beyaz üzüm","Muz","Greyfurt","Karpuz","Muz","Portakal","Nar","Karpuz","Armut","Kara üzüm","Greyfurt","Çilek","Greyfurt","Beyaz üzüm","Muz","Muz","Greyfurt","Muz","Greyfurt","Çilek","Muz","Armut","Nar","Çilek","Armut","Karpuz","Çilek","Elma","Portakal","Nar","Nar","Karpuz","Greyfurt","Karpuz","Greyfurt","Çilek","Beyaz üzüm","Karpuz","Nar","Ekşi elma","Ekşi elma","Nar","Ekşi elma","Ekşi elma","Ekşi elma","Muz","Karpuz","Limon","Nar","Armut","Ekşi elma","Greyfurt","Beyaz üzüm","Armut","Kara üzüm","Muz","Ekşi elma","Portakal","Muz","Karpuz","Muz","Beyaz üzüm","Karpuz","Kara üzüm","Kiraz","Çilek","Elma","Beyaz üzüm","Beyaz üzüm","Beyaz üzüm","Armut","Elma","Portakal","Kara üzüm","Kiraz","Limon","Kiraz","Nar","Ekşi elma","Karpuz","Çilek","Çilek","Ekşi elma","Kiraz","Elma","Greyfurt","Çilek","Kara üzüm","Armut","Karpuz"];
			
			//yazdirma
			document.getElementById('sirasiz').innerHTML = fruits.join("<br>");
			document.getElementById('asc').innerHTML = listArray(fruits,'asc').join("<br>");
			document.getElementById('desc').innerHTML = listArray(fruits,'desc').join("<br>");
            
          
!
999px
Loading ..................

Console