I\'m not entirely sure if this is possible, but I\'m trying to create a mini faux editor in a browser that runs javascript on the page. Here\'s what I\'ve been trying to do
Thnx @Prodigy && @JayC !!!
such a simple solution, I did not know such a function existed :)
using the eval() function did the trick!!!
HTML
javascript
var cnsl = document.getElementById('cnsl');
function run() {
return eval(cnsl.value); // << did the trick ;)
}
//canvas
var ctx;
function setup() {
var canvas = document.getElementById('canvas');
ctx = canvas.getContext('2d');
}
setup();