<!doctype html>
<html lang="en">
	<head>
		<title>JavaScript Patterns</title>
		<meta charset="utf-8">
	</head>
	<body>
		<script>
			/* Title: Returning functions
			 Description: one function returns another function or create another function on-demand
			 */

			var setup = function () {
				console.log(1);
				return function () {
					console.log(2);
				};
			};
			// using the setup function
			var my = setup(); // alerts 1
			my(); // alerts 2


			 
			// Your setup function can store some private