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

Function myBox

assets/js/click_shape_JS.js:18–28  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16}
17
18function myBox(){
19 //create a shape element
20 let element = document.createElement('div');
21 element.classList.add('box');
22 element.style.top = random(setTopMargin()) + 'px';
23 element.style.left = random(setLeftMargin()) + 'px';
24 element.style.backgroundColor = getColor();
25 element.start = new Date().getTime();
26 element.addEventListener('click', hit);
27 gameArea.appendChild(element);
28}
29
30// Pick a random hex color
31function getColor(){

Callers

nothing calls this directly

Calls 4

randomFunction · 0.70
setTopMarginFunction · 0.70
setLeftMarginFunction · 0.70
getColorFunction · 0.70

Tested by

no test coverage detected