Generation

generate functionSat, 08 Apr 2023

change const randomColor = `rgb(${Math.floor(Math.random() * 256)}, ${Math.floor(Math.random() * 256)}, ${Math.floor(Math.random() * 256)})`; by using const max-color

const randomHex = ()=>{ let hex = Math.floor(Math.random() * 256).toString(16); if (hex.length < 2){ hex = `0${hex}`; } return hex; } const randomColor = ()=>{ const red = randomHex(); const green = randomHex(); const blue = randomHex(); return `#${red}${green}${blue}`; }

Javascript
Generate More

Questions about programming?Chat with your personal AI assistant