JSFiddle - React, Tailwind, and code Playground
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());