Last active
January 22, 2016 04:42
-
-
Save arbo-hacker/3b1d17bd888a8dd890c7 to your computer and use it in GitHub Desktop.
Encode and Decode string in Javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Decode a base-64 encoded string: | |
var quote = "Stay hungry. Stay foolish."; | |
var encode = window.btoa(quote); | |
var decode = window.atob(encode); | |
console.log("Encoded String: " + enc + "<br>" + "Decoded String: " + dec); | |
// The result will be: | |
// Encoded String: U3RheSBodW5ncnkuIFN0YXkgZm9vbGlzaC4= | |
// Decoded String: Stay hungry. Stay foolish. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment