Skip to content
This repository
branch: master
file 26 lines (23 sloc) 0.635 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
<!doctype html>
<html lang="en">
<head>
<title>JavaScript Patterns</title>
<meta charset="utf-8">
</head>
<body>
<script>
/* Title: Access to the Global Object
* Description: access the global object without hard-coding the identifier window
*/

// access to the Global Object
// this should work in ES3, ES5 and ES5-strict.
var global = (function () {
return this || (1, eval)('this');
}());

// Test Cases
// http://jsperf.com/globalx

// References
// http://net.tutsplus.com/tutorials/javascript-ajax/the-essentials-of-writing-high-quality-javascript/
</script>
</body>
</html>
Something went wrong with that request. Please try again.