css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <!DOCTYPE html><html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width" />
  <title>split</title>
  <link rel="stylesheet" href="style.css" />
</head>
<body>
  <h1>split</h1>
  <div id="test"></div>

<nav id="nav">
    <div id="test0"></div>
  
  <div id="test1"></div>

  <div id="test2"></div>

  <div id="test3"></div>

  <div id="test4"></div>

  <div id="test5"></div>

  <div id="test6"></div>

  <div id="test7"></div>

  <div id="test8"></div>

  <div id="test9"></div>
</nav>
<button id="reload">Reload</button>
<p id="final"></p>
  <script src="script.js"></script>
</body>
</html>

            
          
!
            
              nav {
font-size: 22px;
text-decoration: underline;
}

body {
width: 100%;
max-width: 1000px;
height: 100%;
}

div {
padding-top: 10px;
}
            
          
!
            
              function compare(a, b) { // функция для сортировки от меньшего к большеиу
return a - b;
}

var reloadB = document.getElementById('reload');
reloadB.onclick = reloadBF; // кликнув по кнопке сработает код сверху вниз

function reloadBF() {
for (var o = 5; o > 0; o--) { // 5 раз прогоняем цикл
var arr = []; // сюда записываем

for (var i = 100; i > 0; i--) { // повторяем 4 раза, если больше(меньше) меняем условие
var ran = Math.floor(Math.random() * 10);
var lastItem = arr.push(ran); // записываем в пустой массив рандомные числа ran
var sorts = arr.sort(compare); // сортируем их
test.innerHTML = sorts;
}

var test1 = document.getElementById('test');
var test0 = document.getElementById('test0');
var test1 = document.getElementById('test1');
var test2 = document.getElementById('test2');
var test3 = document.getElementById('test3');
var test4 = document.getElementById('test4');
var test5 = document.getElementById('test5');
var test6 = document.getElementById('test6');
var test7 = document.getElementById('test7');
var test8 = document.getElementById('test8');
var test9 = document.getElementById('test9');

// считаем сколько каких цифр
var count0 = 0;
for(var i0 = 1; i0 < arr.length; i0++){
    if(arr[i0] == 0)
        count0++;
}

test0.innerHTML = "0" + " : "  + count0;

var count1 = 0;
for(var i1 = 1; i1 < arr.length; i1++){
    if(arr[i1] == 1)
        count1++;
}

test1.innerHTML = "1" + " : "  + count1;

var count2 = 0;
for(var i2 = 0; i2 < arr.length; i2++){
    if(arr[i2] == 2)
        count2++;
}

test2.innerHTML = "2" + " : " + count2;

var count3 = 0;
for(var i3 = 0; i3 < arr.length; i3++){
    if(arr[i3] == 3)
        count3++;
}

test3.innerHTML = "3" + " : " + count3;

var count4 = 0;
for(var i4 = 0; i4 < arr.length; i4++){
    if(arr[i4] == 4)
        count4++;
}

test4.innerHTML = "4" + " : " + count4;

var count5 = 0;
for(var i5 = 0; i5 < arr.length; i5++){
    if(arr[i5] == 5)
        count5++;
}

test5.innerHTML = "5" + " : " + count5;

var count6 = 0;
for(var i6 = 0; i6 < arr.length; i6++){
    if(arr[i6] == 6)
        count6++;
}

test6.innerHTML = "6" + " : " + count6;

var count7 = 0;
for(var i7 = 0; i7 < arr.length; i7++){
    if(arr[i7] == 7)
        count7++;
}

test7.innerHTML = "7" + " : " + count7;

var count8 = 0;
for(var i8 = 0; i8 < arr.length; i8++){
    if(arr[i8] == 8)
        count8++;
}

test8.innerHTML = "8" + " : " + count8;

var count9 = 0;
for(var i9 = 0; i9 < arr.length; i9++){
    if(arr[i9] == 9)
        count9++;
}

test9.innerHTML = "9" + " : " + count9;


var final = document.getElementById('final'); // суда записываем наибольшие числа с каждого прогона


var massive = [];

var newMass = massive.push(count1, count2, count3, count4, count5, count6, count7, count8, count9, count0);

var largest = Math.max.apply(null, massive); // выявляем макс. число
if (count1 == largest){
final.innerHTML += "<strong>1</strong> : " + "<em>" + largest + " ; ";
}

if (count2 == largest){
final.innerHTML += "<strong>2</strong> : " + "<em>" + largest + " ; ";
}

if (count3 == largest){
final.innerHTML += "<strong>3</strong> : " + "<em>" + largest + " ; ";
}

if (count4 == largest){
final.innerHTML += "<strong>4</strong> : " + "<em>" + largest + " ; ";
}

if (count5 == largest){
final.innerHTML += "<strong>5</strong> : " + "<em>" + largest + " ; ";
}

if (count6 == largest){
final.innerHTML += "<strong>6</strong> : " + "<em>" + largest + " ; ";
}

if (count7 == largest){
final.innerHTML += "<strong>7</strong> : " + "<em>" + largest + " ; ";
}

if (count8 == largest){
final.innerHTML += "<strong>8</strong> : " + "<em>" + largest + " ; ";
}

if (count9 == largest){
final.innerHTML += "<strong>9</strong> : " + "<em>" + largest + " ; ";
}

if (count0 == largest){
final.innerHTML += "<strong>0</strong> : " + "<em>" + largest + " ; ";
}

test.innerHTML = ""; // к концу прогона делаем все переменные пустыми,что-бы перезаписать в них новые числа
arr = "";
test.innerHTML = sorts;
} // конец фор
} // конец функции

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console