MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / generatearray

Function generatearray

assets/js/countingsort.js:4–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2
3// Function to generate the array of blocks
4function generatearray() {
5for (var i = 0; i < 20; i++) {
6 // Return a value from 1 to 100 (both inclusive)
7 var value = Math.ceil(Math.random() * 20);
8
9 // Creating element div
10 var array_ele = document.createElement("div");
11
12 // Adding class 'block' to div
13 array_ele.classList.add("block");
14
15 // Adding style to div
16 array_ele.style.height = `${value * 13}px`;
17 array_ele.style.transform = `translate(${i * 30}px)`;
18
19 // Creating label element for displaying
20 // size of particular block
21 var array_ele_label = document.createElement("label");
22 array_ele_label.classList.add("block_id");
23 array_ele_label.innerText = value;
24
25 // Appending created elements to index.html
26 array_ele.appendChild(array_ele_label);
27 container.appendChild(array_ele);
28}
29}
30
31// Function to generate the frequency array
32var count_container = document.getElementById("count");

Callers 1

countingsort.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected