<!DOCTYPE html><html><head><title></title></head><body><pre><script>
function addf( first )
{
return function( second ) // closure means it can access outer variable
{
return first + second;
};
}
document.writeln( addf(1)(2) ) // 3
</script></pre></body></html>