added js closure snippet