Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Added Hex to Binary conversion #805

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
raklaptudirm merged 8 commits into TheAlgorithms:master from ddhira123:master
Oct 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions Conversions/HexToBinary.js
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,14 @@ const binLookup = (c) => {
}
const hexToBinary = (hexString) => {
/*
Function for convertung Hex to Binary
Function for converting Hex to Binary

1. We convert every hexadecimal bit to 4 binary bits
2. Conversion goes by searching in the lookup table

*/

let result = ''
hexString = hexString.split('')
hexString.forEach(c => { result += binLookup(c) })
return result
const hexLexemes = hexString.split('')
return hexLexemes.map(lexeme => binLookup(lexeme)).join('')
}

export default hexToBinary

AltStyle によって変換されたページ (->オリジナル) /