How to Convert between RGB and Hex in JavaScript

How to Convert between RGB and Hex in JavaScript