- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
eval() function in JavaScript
The eval() function accepts a string value which holds JavaScript code. This function executes the given code and returns the result of the code.
Syntax
Its Syntax is as follows
eval(32*45);
Example
<html> <head> <title>JavaScript Example</title> </head> <body> <script type="text/javascript"> document.write(eval(32*45)); document.write("<br>"); document.write(eval(new String("Hello welcome to Tutorialspoint"))); </script> </body> </html>
Output
1440 Hello welcome to Tutorialspoint
- Related Articles
- eval() function in PHP
- What is the use of JavaScript eval function?
- Why is using the JavaScript eval() function a bad idea?
- What is the difference between void, eval, and the Function constructor in JavaScript?
- Explain JavaScript eval() function what are the rules to be followed while using it.
- JavaScript fetch a specific value with eval()?
- Python eval()
- eval method in Python?
- Evaluate the sum of rows using the eval() function – Python Pandas
- Function returning another function in JavaScript
- Function Expression vs Function Declaration in JavaScript?
- ArrayBuffer.isView() function in JavaScript
- ArrayBuffer.slice() function in JavaScript
- Atomics.add() function in JavaScript
- Atomics.and() function in JavaScript

Advertisements