---
title: "Execution Context in JavaScript"
author: "standalone"
date: "2013-01-18T22:46:10Z"
tags: []
categories: ["编程语言"]
slug: "execution-context-in-javascript"
draft: false
lastmod: "2013-01-18T22:46:10Z"
id: 1772371
url: "https://standalone.iteye.com/blog/1772371"
---

Do you know the output of the code below:


```javascript

(function() {

    console.log(typeof foo); // function pointer
    console.log(typeof bar); // undefined

    var foo = 'hello',
        bar = function() {
            return 'world';
        };

    function foo() {
        return 'hello';
    }

}());​

```


If you are not clear about this question, please read this [article](http://davidshariff.com/blog/what-is-the-execution-context-in-javascript/).