JSFiddle - React, Tailwind, and code Playground

HTML

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/ui-lightness/jquery-ui.css">

JavaScript

var counter = function( value ) {

    return function( addValue ) {
        value += ~~addValue;
        return value;
    };
}( 10 );


console.log( counter( 2 ) ); // 12
console.log( counter( 5 ) ); // 17
console.log( counter( 3 ) ); // 20
console.log( counter( 7 ) ); // 27
console.log( counter( 1 ) ); // 28