I'm trying to use the btoa() method with JavaScript to create a base-64 encoded string and then output that string in my console. When I run the code below in my IDE (WebStorm), I get an error stating that btoa is not defined. However, when I run it in Google Chrome using Developer Tools, it works perfectly fine.
const str = "Hello, World!"
const encodedStr = btoa(str);
console.log(encodedStr);
Any thoughts would be much appreciated.