eval() Function in JavaScript - JavaScript Tutorial 19

Published: 06 February 2017
on channel: ChidresTechTutorials
10,710
216

Notes for You:: eval() Function in JavaScript - JavaScript Tutorial 19
As the name itself indicating, eval function tries to evaluate the given value and returns a number. Otherwise returns an error.
Where:
Value can be: a number, expression, string, or JavaScript statement.

Example Code:

document.write(eval(2)); //2
document.write(parseInt(2)); //2
document.write(parseFloat(2)); //2

document.write(eval(3.142)); //3.142
document.write(parseInt(3.142)); //3
document.write(parseFloat(3.142)); //3.142

document.write(eval(2+2)); //4
document.write(parseInt(2+2)); //4
document.write(parseFloat(2+2)); //4

document.write(eval(1.6+1.6)); //3.142
document.write(parseInt(1.6+1.6)); //3
document.write(parseFloat(1.6+1.6)) //3.142

document.write(parseInt("24sometext")); //24
document.write(parseFloat("24sometext")); //24
//document.write(eval("24sometext")); //error

document.write(parseInt("2+2")); //2
document.write(parseFloat("1.6+1.6")); //1.6
document.write(eval("1.6+1.6")); //3.2

document.write(eval("var a=10,b=20,c=a+b;c;"));//30

=========================================

Follow the link for next video:
JavaScript Tutorial 20 - Operators in JavaScript | JavaScript Operators
   • Operators in JavaScript - JavaScript ...  

Follow the link for previous video:
JavaScript Tutorial 18 - parseFloat() Function in JavaScript | JavaScript parseFloat()
   • parseFloat() Function in JavaScript -...  

=========================================

JavaScript Tutorials Playlist:-
   • JavaScript Tutorials  

=========================================
Watch My Other Useful Tutorials:-

jQuery Tutorials Playlist:-
   • jQuery Tutorials  

jQuery UI Tutorials Playlist:-
   • jQuery UI Tutorials  

Bootstrap Tutorials Playlist:-
   • Bootstrap4 Tutorials  

=========================================

HI, I am Manjunath Chidre and I'm an Indian born. I make video tutorials on Computer Science, Information Technology, Animation, VFX, Multimedia, & Gaming courses. Essentially, I set my goal to help students around the world; to learn at free of cost; through my educational YouTube channel Chidre'sTechTutorials.

=========================================

Every video on my channel is made with Love and Hard work, So don't forget to Like, Comment & Share.
Please do Subscribe, Hit the bell icon & Enjoy Learning. It's FREE.

=========================================

Subscribe to our YouTube channel:-
   / chidrestechtutorials  

Join as member of our YouTube channel:-
https://www.youtube.com/chidrestechtu...

Become our Patron:-
  / chidrestechtutorials  

Visit our Website:-
https://www.chidrestechtutorials.com

Download our Notes from Instamojo:-
https://chidrestechtutorials.myinstam...

Buy our Products on Spring:-
https://chidres-tech-tutorials.creato...

=========================================
Follow us:-

Google My Business:-
https://chidrestechtutorials.business...

Google Blog:-
http://manjunathchidre.blogspot.com

LinkedIn:-
  / chidrestechtutorials  

Facebook:-
  / chidrestechtutorials  

Twitter:-
  / manjunathchidre  

Tumblr:-
  / chidrestechtutorials  

Pinterest:-
  / chidrestechtutorials  

=========================================

Despite my inconsistent uploads; Thanks for being amazing learners and still sticking with me on YouTube.

=========================================
Hash Tags:-
#ChidresTechTutorials #JavaScript #JavaScriptTutorial


On this page of the site you can watch the video online eval() Function in JavaScript - JavaScript Tutorial 19 with a duration of hours minute second in good quality, which was uploaded by the user ChidresTechTutorials 06 February 2017, share the link with friends and acquaintances, this video has already been watched 10,710 times on youtube and it was liked by 216 viewers. Enjoy your viewing!