File tree 2 files changed +15
-0
lines changed
2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * Converts a binary string to a decimal number.
3
+ *
4
+ * @param {string } binaryString - The binary string to be converted to decimal.
5
+ * @returns {number } The decimal representation of the binary string.
6
+ */
1
7
export default function binaryToDecimal ( binaryString ) {
2
8
let decimalNumber = 0
3
9
const binaryDigits = binaryString . split ( '' ) . reverse ( ) // Splits the binary number into reversed single digits
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Converts RGB color values to a hexadecimal color code.
3
+ *
4
+ * @param {number } r - The red color value (0-255).
5
+ * @param {number } g - The green color value (0-255).
6
+ * @param {number } b - The blue color value (0-255).
7
+ * @returns {string } The hexadecimal color code representing the RGB values.
8
+ * @throws {TypeError } If any of the arguments is not a number.
9
+ */
1
10
function RGBToHex ( r , g , b ) {
2
11
if ( typeof r !== 'number' || typeof g !== 'number' || typeof b !== 'number' ) {
3
12
throw new TypeError ( 'argument is not a Number' )
You can’t perform that action at this time.
0 commit comments