JSFiddle - React, Tailwind, and code Playground

by Trần Ngọc Minh

JavaScript

function add() {

    var counter = 0;

    function plus()

     {

        //hàm plus (inner function) có thể truy cập đến biến của hàm  

        //add (outer function)

           counter += 1;

    }

    plus();   

    return counter;

}

alert (add());