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

Function generatearray

assets/js/quicksort.js:4–30  ·  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() * 100);
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 * 3}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 =
22 document.createElement("label");
23 array_ele_label.classList.add("block_id");
24 array_ele_label.innerText = value;
25
26 // Appending created elements to index.html
27 array_ele.appendChild(array_ele_label);
28 container.appendChild(array_ele);
29}
30}
31
32// Function to generate indexes
33var count_container =

Callers 1

quicksort.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected