Answered step by step
Verified Expert Solution
Question
1 Approved Answer
in javascript I got it where the user can type a function and hit a button to evaluate it and print it out in a
in javascript I got it where the user can type a function and hit a button to evaluate it and print it out in a div --with eval(). My problem is I cant get console.log to work as the contents that contains the function is a string. I tried splice/split but how do I handle multiple console.logs?
Example function:
Textbox--
function hi () { console.log("hi") console("goodbye") console.log("hello again") } |
button
input:
var content = "function hi () { console.log("hi)......}
var results = eval(content)
output:
render{
return(
{results}
)
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started