-2

I searched about this a lot but I still don't get it.

I mean look at this website, https://www.computerhope.com/issues/ch001632.htm

It says that from Binary to string, I have to convert it to ASCII first, okay okay I understood this, then it says in order convert to ASCII, you have to convert it to decimal first(which I suppose it uses parseInt() function?) then after you convert to decimal, you have to convert it finally to ASCII.

I looked at other websites(except the websites that give you the direct Javascript code, I don't want that) and I have seen that most websites follow this logic, from Binary to decimal, from decimal to ASCII, and the browser will translate ASCII to string visually.

Now the problem is, how I'm supposed to convert decimal to ASCII then convert it to string? I searched at web about ASCII standards and I suppose it needs a lot of If condition(there are no pattern I between them I suppose), https://www.computerhope.com/jargon/a/ascii.htm

I just need a method to do that in Javascript(if there is), I searched about that and I only found parseInt(which its job is to translate Binary to decimal) and toString(which I suppose it doesn't do the job I need)

Is there something like that(in-built function or a method)? If there are not something like that, can you give me an algorithm to do that? And please don't give me the code, just give me what I need and I will do it myself, thank you.

EDIT: My question is different, can you please read the question before flagging it? I asked for a way to convert from decimal to ASCII and not from character to ASCII, it's completely different thing.

TechnoKnight
  • 961
  • 1
  • 6
  • 9
  • Possible duplicate of [Convert character to ASCII code in JavaScript](https://stackoverflow.com/questions/94037/convert-character-to-ascii-code-in-javascript) – TAHA SULTAN TEMURI Jun 23 '18 at 12:44

1 Answers1

-1

Nevermind. I found the answer.

It seems that I mixed stuff up, parseInt actually returns the decimal number and fromCodePoint returns the ASCII/UTF code as a string.

So yeah, it seems that I had the answer at the very start but I didn't know how to use it.

TechnoKnight
  • 961
  • 1
  • 6
  • 9
  • I'm glad you sorted it out. Note: ASCII is not a relevant character set or character encoding. Computerized text is always in exactly one character encoding (in JavaScript and many languages, that's the UTF-16 encoding of Unicode) or is codepoints in exactly one character set (the argument to `fromCodePoint`), [It is very unlikely that you'll ever write code that uses ASCII.] – Tom Blodget Jun 23 '18 at 23:37