Skip to content
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

第 116 期(W3C 标准-JavaScript):atob & btoa —— base64 的解码编码 #119

Open
wingmeng opened this issue Sep 25, 2019 · 0 comments

Comments

@wingmeng
Copy link
Collaborator

atob()btoa() 方法用于对字符串进行 base64 解码和编码,其中:

  • atob() 用于解码,例如:window.atob('aGVsbG8gd29ybGQ=')
  • btoa() 用于编码,例如:window.btoa('hello world')

它们 API 的命名颇具喜感,这里要注意 不要atob 望文生义成 Any to Base64。可以这样来记忆:
字母 A 排在 字母 B 前面,所以 A 要比 B “高级”,A 就代表高级的 Base64,而 B 则代表普通的字符串。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant