<h2>JavaScript Dizi Sıralama</h2> <button onclick="siralama()">Sırala</button> <p id="demo"></p> <script> var arabalar = [ {tur:"araba1", model:5}, {tur:"araba2", model:12}, {tur:"araba3", model:3} ]; arabalariGoster(); function siralama() { arabalar.sort(function(a, b){return a.model - b.model}); arabalariGoster(); } function arabalariGoster() { document.getElementById("demo").innerHTML = arabalar[0].tur + " " + arabalar[0].model + "<br>" + arabalar[1].tur + " " + arabalar[1].model + "<br>" + arabalar[2].tur + " " + arabalar[2].model; } </script>