index.js
function rgbToHex(rgb) {

    function componentToHex(c) {
      var hex = c.toString(16).toUpperCase();
      return hex.length === 1 ? "0" + hex : hex;
    }

    var color = rgb.map(function(component) {
      return componentToHex(parseInt(component * 255));
    });

    color.unshift("0X");
    color = color.join("");
    return parseInt(color);

  }
function rgbToHex(rgb) {

    function componentToHex(c) {
      var hex = c.toString(16).toUpperCase();
      return hex.length === 1 ? "0" + hex : hex;
    }

    var color = rgb.map(function(component) {
      return componentToHex(parseInt(component * 255));
    });

    color.unshift("0X");
    color = color.join("");
    return parseInt(color);

  }
Converts decimal values in the range 0-1 to hexadecimal values between 00 and FF.
@param {Array} rgb: An array of three values, representing red, green and blue values.