<!doctype html>
<html lang="en">
	<head>
		<title>JavaScript Patterns</title>
		<meta charset="utf-8">
	</head>
	<body>
		<script>
			/* Title: Callback patterns
			 Description: when you pass function A to function B as a parameter, function A is a callback function
			 */

			var complexComputation = function () { /* do some complex stuff and return a node */
			};

			var findNodes = function (callback) {
				var nodes = [];

				var node = complexComputation();

				// call if callback is callable
				i