Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
39 lines (32 sloc) 789 Bytes
<!doctype html>
<html lang="en">
<head>
<title>JavaScript Patterns</title>
<meta charset="utf-8">
</head>
<body>
<script>
/* Title: Immediate functions
Description: syntax that enables function execution as soon as it is defined
*/
(function () {
console.log('watch out!');
}());
//alternative with less parentheses
!function () {
console.log('watch out!');
}();
//another alternative with less parentheses
+function () {
console.log('watch out!');
}();
//crockfords the good part book way of doing this
(function () {
console.log('watch out!');
}());
// reference
// http://www.jspatterns.com/
// http://shop.oreilly.com/product/9780596806767.do?sortby=publicationDate
</script>
</body>
</html>