Deutsch
Germany.ruФорумы → Архив Досок→ Программирование

​Кто знает ЯваСкрипт?

13.12.22 08:54
Re: ​Кто знает ЯваСкрипт?
 
gendy Dinosaur
gendy
в ответ 7495 13.12.22 08:35

To convert a hex to decimal, call the parseInt() function, passing the hex and 16 as the first and second arguments respectively, i.e., parseInt(hex, 16). For example:

function hexToDec(hex) {
  return parseInt(hex, 16);
}

console.log(hexToDec('f')); // 15
console.log(hexToDec('abc')); // 2748
console.log(hexToDec(345)); // 837 



https://codingbeautydev.com/blog/javascript-convert-hex-to...

Фашизм будет разбит


Человека карают только те боги, в которых он верит

 

Перейти на