V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐关注
Meteor
JSLint - a JavaScript code quality tool
jsFiddle
D3.js
WebStorm
推荐书目
JavaScript 权威指南第 5 版
Closure: The Definitive Guide
flowfire

atob 和 btoa 方法名是不是反了。。。。

  •  
  •   flowfire · Dec 22, 2017 · 3181 views
    This topic created in 3049 days ago, the information mentioned may be changed or developed.

    按我的理解
    atob => ascii to base64 => input ascii output base64
    btoa => base64 to ascii => input base64 output ascii

    2 replies    2017-12-23 08:12:19 +08:00
    koebehshian
        1
    koebehshian  
       Dec 22, 2017
    https://stackoverflow.com/questions/33854103/why-were-javascript-atob-and-btoa-named-like-that

    b 是 binary,a 是 ascii,因为 base 的字符串表示是用 ascii 编码的。

    atob()
    Decodes a string of data which has been encoded using base-64 encoding.
    btoa()
    Creates a base-64 encoded ASCII string from a "string" of binary data.
    DevilBin
        2
    DevilBin  
       Dec 23, 2017 via Android
    😝我也是这么想的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5988 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 46ms · UTC 02:16 · PVG 10:16 · LAX 19:16 · JFK 22:16
    ♥ Do have faith in what you're doing.