Previous Article Next Article Functional JavaScript Programming 7 – Lazy Evaluation
Posted in JavaScript

Functional JavaScript Programming 7 – Lazy Evaluation

Functional JavaScript Programming 7 – Lazy Evaluation Posted on June 8, 2018Leave a comment

Best book for Functional Programming in JS –

What is Lazy Evaluation in JavaScript?
How to get started in Functional Programming on JavaScript?

In this video tutorial, I talk about the basics of Functional Programming by bringing in the Lazy Evaluation. What is it? Find out in the video.


1. An evaluation strategy, that delays the evaluation of an expression in programming until its value is needed
2. This is also known as non-strict evaluation
3. Also known as call-by-need
4. An evaluation strategy is used by a programming language to determine when to evaluate the arguments passed into a function call
5. It also results in sharing of space, which allows programs to be run at high speed
6. An important advantage of using lazy evaluation is the ability to define potentially infinite data structures
7. You only evaluate an expression once you need it, so it is a very common property of purely functional programming languages, that intend to win back performance
8. There are no side-effects to the expressions, hence we can use lazy evaluation easily without worrying about the order of computation
9. In a Tree data-structure, the tree is never evaluated unless the result is used somewhere, saving us a lot of time
10. An infinite syntax tree can be used in a recursive form
11. Instead of using primitives in the control flow, abstractions are used that don’t evaluate and store data somewhere
12. The overall performance increases, by avoiding needless calculations
13. The opposite is known as eager evaluation – greedy evaluation – strict evaluation
14. However, it isn’t preferred in functions where order is important
15. Delayed evaluation is highly common in functional programming languages
16. Calculable infinite lists without infinite loops or size matters interfering in computation
17. The reason lazy evaluation is useful, even though it causes the programmer to lose control over the order in which their code is executed, is because of MODULARITY
18. Opens door to many other possibilities: asynchronous execution, parallelization, composition etc.

Code File –
JSFiddle –

Lazy Evaluation in Functional JavaScript Programming by Rocky DeRaze

Leave a Reply

Your email address will not be published. Required fields are marked *