var str = 'javascript'; window.btoa(str) //转码结果 "amF2YXNjcmlwdA==" window.atob("amF2YXNjcmlwdA==") //解码结果 "javascript" 完事了。。