How to get random hex color in JavaScript

Numbers
By Jad Joubran · 
Last updated Feb 18, 2020
const hex = Math.floor(Math.random() * 0xffffff)
  .toString(16)
  .padStart(6, "0");
const color = `#${hex}`;

console.log(color);
#a75d43