MCPcopy Create free account
hub / github.com/AyushSaini00/60minuteJavaScript / generateHEX

Function generateHEX

Random-Color-Generator/app.js:3–11  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1const hexValueElement = document.querySelector('.hex-value');
2
3function generateHEX(){
4 let randomHex =
5 Math.random() //random number between 0 and 1
6 .toString(16) //convert that number to hexadecimal string (i.e, base 16)
7 .substr(-6); //grab last 6 digit string
8 let randomHexColor = `#${randomHex}`;
9 hexValueElement.textContent = randomHexColor;
10 document.body.style.background = randomHexColor;
11}
12
13function keybord(event){
14 if(event.code == 'Space'){

Callers 1

keybordFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected