const Web3 = require("web3");

function decimalToHexadecimal(decimalNumber) {
  return Web3.utils.toHex(decimalNumber);
}

// Run the function and log the result
const decimalNumber = 255;
const hexadecimalNumber = decimalToHexadecimal(decimalNumber);
console.log(
  `The hexadecimal representation of ${decimalNumber} is ${hexadecimalNumber}`
);

The hexadecimal representation of 255 is 0xff
const Web3 = require("web3");

function decimalToHexadecimal(decimalNumber) {
  return Web3.utils.toHex(decimalNumber);
}

// Run the function and log the result
const decimalNumber = 255;
const hexadecimalNumber = decimalToHexadecimal(decimalNumber);
console.log(
  `The hexadecimal representation of ${decimalNumber} is ${hexadecimalNumber}`
);

The hexadecimal representation of 255 is 0xff