Can js operate a hexadecimal number that converts a decimal number into a 2-byte hexadecimal number?

the application scenario is to pass a decimal color value in the background:-65536. You want the final conversion result to be FFFF0000
, but the conversion method of js is wrong. The problem is that-65536 = > FFFF0000 is a 2-byte conversion, but js is not.
for advice ~ Thank you in advance.

Apr.09,2021

function decimalToHexString(number)
{
  if (number < 0)
  {
    number = 0xFFFFFFFF + number + 1;
  }

  return number.toString(16).toUpperCase();
}
decimalToHexString(-65536) //"FFFF0000"
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea91e8-1f2a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea91e8-1f2a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?