JSFiddle - React, Tailwind, and code Playground

by Jessie Lau

HTML

For example:

Given a function add

function add (a, b) {
  return a + b;
}
One could make it lazy as:

var lazy_value = make_lazy(add, 2, 3);
The expression does not get evaluated at the moment, but only when you invoke lazy_value as:

lazy_value() => 5
The above invokation then performs the sum.

Please note: The functions that are passed to make_lazy may take one or more arguments and the number of arguments is not fixed.

JavaScript

var make_lazy = function () {
  // TODO: implement this function
};