仅反对浏览器端:

// 字符串编码function encode (str) {    return window.btoa(encodeURIComponent(str))}// 字符串解码function decode(str) {    return decodeURIComponent(atob(str))}console.log(encode('yangyingjie'))