Base64 decode data: Difference between revisions

Added JavaScript solution with Node.js and Browser variants.
m (→‎{{header|F Sharp|F#}}: fix heading, as suggested on the Count examples/Full list/Tier 4 talk page)
(Added JavaScript solution with Node.js and Browser variants.)
Line 883:
<pre>To err is human, but to really foul things up you need a computer.
-- Paul R. Ehrlich</pre>
 
=={{header|JavaScript}}==
=== Browser ===
<lang javascript>// define base64 data; in this case the data is the string: "Hello, world!"
const base64 = 'SGVsbG8sIHdvcmxkIQ==';
// atob is a built-in function.
console.log(atob(base64));</lang>
=== Node.js ===
<lang javascript>// define base64 data; in this case the data is the string: "Hello, world!"
const base64 = Buffer.from('SGVsbG8sIHdvcmxkIQ==', 'base64');
// <Buffer>.toString() is a built-in method.
console.log(base64.toString());</lang>
{{out}}
<pre>Hello, world!</pre>
 
=={{header|jq}}==