javascript closures, firstclass, inner functions, closures with loop