0
Anyone knows how base64 in JS works? How do i decode base64 in JS?
const base64 = require('base-64'); const str = 'Zm9vIMKpIGJhciDwnYyGIGJheg==' const decodeThisMsg = (msg) => { return base.64.decode(str); }; console.log(decodeMsg(str); I keep seeing "require is not defined"
5 Answers
+ 1
Your code is for node.js.
For use in web browsers do:
<script src="https://raw.githack.com/beatgammit/base64-js/master/base64js.min.js"></script>
+ 1
Here you go
https://code.sololearn.com/WEsMM6Q1xV6L/?ref=app
+ 1
Node runs on web server, you need to install node on localhost or external server, upload the codes to the server or localhost. Browsers then can request the service from the web server.
0
So how do I go about solving it? I'm actually still new to JS
0
Thanks.
If I actually want to use d node.js, how do I go about it?