MajeedKazemi / blocks-to-code-old

Other
1 stars 0 forks source link

execute the created code #4

Open MajeedKazemi opened 2 years ago

MajeedKazemi commented 2 years ago

convert everything to JS and execute JS locally. This is a better approach compared to using Pyodide as it will allow us to do more interesting things such as getting user input through a modal similar to Scratch, or display output in interesting ways.

Using JS would also allow future versions of the tool to create interactive outputs (draw lines, animate objects, and etc.)

user-74 commented 2 years ago

Agreed, javascript execution is preferred over python, and we can equate logging with print/say statements.

The following is an example of how we can do this.

var test = "console.log("Hello World");"

function execute(code) {
  var F = new Function(code);
  return (F());
}

execute(test);
MajeedKazemi commented 2 years ago

use prompt to get input from user and test it