Enter a custom function on the front-end page and save the data to the database. Next time, by requesting the background, get the custom function list, and how to execute the function list directly after getting it.

if you need to do so, you can manually add custom functions and save them to the database. Next time, you need to get all the functions and execute them in turn to get the results. Doesn"t it become a string when it is saved in the database? how to execute these strings in turn to get the results of the custom function

Mar.24,2021

new Function(/*your code string*/);
//or
eval(/*your code string*/)

add some examples

// 
const codeString = `function abc(){
    console.log("hello world")
}`;

//1
const myABC = new Function(`return ${codeString}`)();
myAbC();//hello world

//2
eval(`var myABC2 = ${codeString}`);
myABC2();//hello world

the above is the implementation of your requirements.

Menu