How to execute a valid code string in JavaScript?
Originally Published Here ๐!
To execute a code string, you can use the eval() global function in JavaScript.
Consider a string which itself is a valid piece of JavaScript code like this,
// javascript code as string
const codeStr = `
if(12 > 10){
...
melvingeorge-me.hashnode.dev1 min read