This content originally appeared on DEV Community and was authored by Raghav Yadav
Ever wondered how to execute string in JavaScript as a command?
Well just use:
var command = "alert('test')";
eval(command); // alerts "test"
AND if you enjoyed the article hit the ? and that ?!
This content originally appeared on DEV Community and was authored by Raghav Yadav
Print
Share
Comment
Cite
Upload
Translate
Updates
There are no updates yet.
Click the Upload button above to add an update.
APA
MLA
Raghav Yadav | Sciencx (2021-05-14T06:48:36+00:00) How to execute a string as command in javascript. Retrieved from https://www.scien.cx/2021/05/14/how-to-execute-a-string-as-command-in-javascript/
" » How to execute a string as command in javascript." Raghav Yadav | Sciencx - Friday May 14, 2021, https://www.scien.cx/2021/05/14/how-to-execute-a-string-as-command-in-javascript/
HARVARDRaghav Yadav | Sciencx Friday May 14, 2021 » How to execute a string as command in javascript., viewed ,<https://www.scien.cx/2021/05/14/how-to-execute-a-string-as-command-in-javascript/>
VANCOUVERRaghav Yadav | Sciencx - » How to execute a string as command in javascript. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/05/14/how-to-execute-a-string-as-command-in-javascript/
CHICAGO" » How to execute a string as command in javascript." Raghav Yadav | Sciencx - Accessed . https://www.scien.cx/2021/05/14/how-to-execute-a-string-as-command-in-javascript/
IEEE" » How to execute a string as command in javascript." Raghav Yadav | Sciencx [Online]. Available: https://www.scien.cx/2021/05/14/how-to-execute-a-string-as-command-in-javascript/. [Accessed: ]
rf:citation » How to execute a string as command in javascript | Raghav Yadav | Sciencx | https://www.scien.cx/2021/05/14/how-to-execute-a-string-as-command-in-javascript/ |
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.