Вход на сайт
Кто знает ЯваСкрипт?
4168 просмотров
Перейти к просмотру всей ветки
gendy Dinosaur
в ответ 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...
Фашизм будет разбит
Человека карают только те боги, в которых он верит