We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c6ce0db commit 620e35fCopy full SHA for 620e35f
1 file changed
javascript/5_string-programs/base64.js
@@ -0,0 +1,22 @@
1
+// 14. JavaScript | Encode/Decode a string to Base64
2
+
3
+// 1. btoa() Method
4
5
+// window.btoa( String )
6
7
+function encodeStr() {
8
+ console.log(btoa(str1));
9
+}
10
11
+const str1 = "This is amit";
12
+encodeStr();
13
14
+// 2. atob() Method
15
16
+//window.atob( String )
17
+function decodeStr() {
18
+ console.log(atob(str2));
19
20
21
+const str2 = "VGhpcyBpcyBhbWl0";
22
+decodeStr();
0 commit comments