It’s in React and I am stuck with User Story #9 . What logic should I use in order for the equal(=) sign to work?
Also, any suggestion on how I can improve the logic in my handleOne , handleTwo, handleThree handleAdd etc.
here is my code: https://codepen.io/bradrar1/pen/oMNvMd
Sorry if its messy.
console.log(eval('2 + 2'));
// expected output: 4
Not sure what general consensus your are referring, but this project can definitely be solved without using eval at all. In general, when you are taking input from a user, it is best practice to avoid using eval when displaying back anything involving the input received.
So no malicious code can be input and ran. But being cautious when using eval is something to keep in mind.
Thank you for the the replies.
I used eval because it works for me and next time I will look for other ways to solve this without eval .