A closure provides access to an outer function's scope from an inner function.In the first example, the inner function 'y' accessed the variable 'a' from its outer function 'x'.In the second example, the closure retained access to the variable 'a' even after the outer function 'x' vanished.The third example demonstrates nested closures, where 'y' forms a closure with the scopes of both 'x' and 'z'.