DEV Community

Cover image for JavaScript more efficient and readable code for make a calculator with only 20 lines with
Asad Ullah
Asad Ullah

Posted on

5 1 1 1 1

JavaScript more efficient and readable code for make a calculator with only 20 lines with

Eval Function for a Calculator

Click Here for visit the calculator and its code
This is very very best way to improve and make efficient for our code. The eval() function is very helpful to make efficient, readable and maintainable. As we know about eval() function the eval() is a function property of the global object. The argument of the eval() function is a string. It will evaluate the source string as a script body, which means both statements and expressions are allowed. It returns the completion value of the code. For expressions, it's the value the expression evaluates to.

Comment me if you have impressive by this calculator.

Click Here for visit the calculator and its code

Top comments (2)

Collapse
 
trungho profile image
Hồ Phước Trung

I don't even dare look back at what I wrote before :'( my html css js calculator

Collapse
 
habibasarwar786 profile image
HabibaSarwar786

Thank you so much. I've try your code. Its working. This is so amazing code its such a clean code. Thank you So Much Sayyed Asad Ullah.

The best way to debug slow web pages cover image

The best way to debug slow web pages

Tools like Page Speed Insights and Google Lighthouse are great for providing advice for front end performance issues. But what these tools can’t do, is evaluate performance across your entire stack of distributed services and applications.

Watch video

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay