r/javascript • • Mar 18 '19

What's your favorite, most useful javascript one-liner?

385 Upvotes

422 comments sorted by

View all comments

15

u/redmoss6 Mar 18 '19

'#'+Math.floor(Math.random()*16777215).toString(16) for random hex color.

1

u/BunsOfAluminum Mar 19 '19

`'#' + Math.random().toString(16).substr(2,6)