JSFiddle - React, Tailwind, and code Playground

by Amresh Venugopal

HTML

<div id='0'></div>

JavaScript

function  outer (x) {
    return function inner(y) {
       return x+y;
    }
}

var a = outer(5);

/**
* Since, a is a function we can invoke it like:
* a(arg)
*/

document.getElementById('0').innerHTML = a;

/**
* Since the value of x is fixed at 5, 
* calling a(arg) will result in the value 5 + arg
*/