0

What does # mean in the following code?

function rndm_colour(){
  var letters = '0123456789ABCDEF';
  var color = '#';
  for (var i = 0; i < 6; i++) {
      color += letters[Math.floor(Math.random() * 16)];
  }
  return color
}
Loc Dang
  • 73
  • 7
  • 3
    It's creating a random colour in the HEX color format, which requires a `#` as a prefix – Nick Parsons Aug 01 '20 at 03:12
  • 2
    This question does not show any effort to convey what you have *actually* tried? [Similar post](https://stackoverflow.com/questions/22239803/how-does-hexadecimal-color-work) – Tanner Dolby Aug 01 '20 at 03:15

2 Answers2

2

It looks like this function generates a random HTML Color code, which begins with a #.

2

The code creates a random color in the HEX format. All HEX colors always start with a "#".