<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Scope chain of JScript Functions</title><link>http://blogs.msdn.com/b/jscript/archive/2007/07/26/scope-chain-of-jscript-functions.aspx</link><description>Scope chain of JScript functions is something programmers find it difficult to understand easily. This is because it is different from the scope chain of functions in programming languages like C, C++. Discussed below are the details of scope chain of</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Scope chain of JScript Functions</title><link>http://blogs.msdn.com/b/jscript/archive/2007/07/26/scope-chain-of-jscript-functions.aspx#9994073</link><pubDate>Mon, 12 Apr 2010 06:03:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9994073</guid><dc:creator>Vishal Gupta</dc:creator><description>&lt;p&gt;Hey, I like the article, but I would appreciate if you could clarify the following. So, is there a two way link between the activation objects and the global object? There has to be a link(pointer) from the activation objects towards the global object for scope resolution. But is there also a link the other way around? Because, you mentioned, when function returns, the global object doesn't point to the activation object anymore and therefore it is garbage collected. Also, does this also mean that any object that doesn't have a link(pointer) from the global object is garbage collected? I would appreciate if you could help clarify these doubts. Thanks again!&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9994073" width="1" height="1"&gt;</description></item><item><title>re: Scope chain of JScript Functions</title><link>http://blogs.msdn.com/b/jscript/archive/2007/07/26/scope-chain-of-jscript-functions.aspx#9952453</link><pubDate>Sat, 23 Jan 2010 22:37:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9952453</guid><dc:creator>Paul Podlipensky</dc:creator><description>&lt;p&gt;I'm wondering about JScript.NET private variables. Please take a look on the following code:&lt;/p&gt;
&lt;p&gt;import System;&lt;/p&gt;
&lt;p&gt;import System.Windows.Forms;&lt;/p&gt;
&lt;p&gt;import System.Drawing;&lt;/p&gt;
&lt;p&gt;var jsPDF = function(){&lt;/p&gt;
&lt;p&gt;	var state = 0;&lt;/p&gt;
&lt;p&gt;	var beginPage = function(){&lt;/p&gt;
&lt;p&gt;		state = 2;&lt;/p&gt;
&lt;p&gt;		out('beginPage');&lt;/p&gt;
&lt;p&gt;	}&lt;/p&gt;
&lt;p&gt;	var out = function(text){&lt;/p&gt;
&lt;p&gt;		if(state == 2){			&lt;/p&gt;
&lt;p&gt;			var st = 3;&lt;/p&gt;
&lt;p&gt;		}&lt;/p&gt;
&lt;p&gt;		MessageBox.Show(text + ' ' + state);&lt;/p&gt;
&lt;p&gt;	}&lt;/p&gt;
&lt;p&gt;	var addHeader = function(){&lt;/p&gt;
&lt;p&gt;		out('header');&lt;/p&gt;
&lt;p&gt;	}		&lt;/p&gt;
&lt;p&gt;	return {&lt;/p&gt;
&lt;p&gt;		endDocument: function(){&lt;/p&gt;
&lt;p&gt;			state = 1;&lt;/p&gt;
&lt;p&gt;			addHeader();&lt;/p&gt;
&lt;p&gt;			out('endDocument');&lt;/p&gt;
&lt;p&gt;		},&lt;/p&gt;
&lt;p&gt;		beginDocument: function(){&lt;/p&gt;
&lt;p&gt;			beginPage();&lt;/p&gt;
&lt;p&gt;		}&lt;/p&gt;
&lt;p&gt;	}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;var j = new jsPDF();&lt;/p&gt;
&lt;p&gt;j.beginDocument();&lt;/p&gt;
&lt;p&gt;j.endDocument();&lt;/p&gt;
&lt;p&gt;Output:&lt;/p&gt;
&lt;p&gt;beginPage 2&lt;/p&gt;
&lt;p&gt;header 2&lt;/p&gt;
&lt;p&gt;endDocument 2&lt;/p&gt;
&lt;p&gt;if I run the same script in any browser, the output is:&lt;/p&gt;
&lt;p&gt;beginPage 2&lt;/p&gt;
&lt;p&gt;header 1&lt;/p&gt;
&lt;p&gt;endDocument 1&lt;/p&gt;
&lt;p&gt;Why it is so??&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Paul.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9952453" width="1" height="1"&gt;</description></item><item><title>re: Scope chain of JScript Functions</title><link>http://blogs.msdn.com/b/jscript/archive/2007/07/26/scope-chain-of-jscript-functions.aspx#9590874</link><pubDate>Wed, 06 May 2009 12:43:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9590874</guid><dc:creator>Venu</dc:creator><description>&lt;p&gt;Nice explanation. Thanks a lot.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9590874" width="1" height="1"&gt;</description></item><item><title>re: Scope chain of JScript Functions</title><link>http://blogs.msdn.com/b/jscript/archive/2007/07/26/scope-chain-of-jscript-functions.aspx#8281385</link><pubDate>Mon, 17 Mar 2008 09:08:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8281385</guid><dc:creator>sam</dc:creator><description>&lt;p&gt;It's a shame that I can't see the image.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8281385" width="1" height="1"&gt;</description></item><item><title>re: Scope chain of JScript Functions</title><link>http://blogs.msdn.com/b/jscript/archive/2007/07/26/scope-chain-of-jscript-functions.aspx#8179969</link><pubDate>Thu, 13 Mar 2008 13:52:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8179969</guid><dc:creator>-TNO-</dc:creator><description>&lt;p&gt;Don't forget this design and how it corresponds to prototype:&lt;/p&gt;
&lt;p&gt;var Foo = (function(){...})();&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8179969" width="1" height="1"&gt;</description></item><item><title>re: Scope chain of JScript Functions</title><link>http://blogs.msdn.com/b/jscript/archive/2007/07/26/scope-chain-of-jscript-functions.aspx#7236862</link><pubDate>Fri, 25 Jan 2008 11:54:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7236862</guid><dc:creator>shivaram.p</dc:creator><description>&lt;p&gt;Voc&amp;#234; &amp;#233; bem-vindo (You are welcome)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7236862" width="1" height="1"&gt;</description></item><item><title>re: Scope chain of JScript Functions</title><link>http://blogs.msdn.com/b/jscript/archive/2007/07/26/scope-chain-of-jscript-functions.aspx#7210438</link><pubDate>Wed, 23 Jan 2008 20:00:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7210438</guid><dc:creator>Marcos Remar</dc:creator><description>&lt;p&gt;Muito bom seu artigo. Foi de grande ajuda. Portuguese(Brazil)&lt;/p&gt;
&lt;p&gt;good!&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7210438" width="1" height="1"&gt;</description></item><item><title>re: Scope chain of JScript Functions</title><link>http://blogs.msdn.com/b/jscript/archive/2007/07/26/scope-chain-of-jscript-functions.aspx#7161302</link><pubDate>Sat, 19 Jan 2008 16:15:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7161302</guid><dc:creator>Webhosting</dc:creator><description>&lt;p&gt;very detailed article. This really helped me clarify some doubts. One quick question, does all of it apply to JavaScript in general or some of it is specific to Microsoft's implementation of JavaScript?&lt;/p&gt;
&lt;p&gt;Lastly, I expect to see few more of this knowledge based article in future. &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7161302" width="1" height="1"&gt;</description></item><item><title>re: Scope chain of JScript Functions</title><link>http://blogs.msdn.com/b/jscript/archive/2007/07/26/scope-chain-of-jscript-functions.aspx#4254787</link><pubDate>Mon, 06 Aug 2007 11:56:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4254787</guid><dc:creator>shivaram.p</dc:creator><description>&lt;p&gt;Thanks for your comments. You can expect more such articles in future. All the scope chain stuff explained in this article is in general.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4254787" width="1" height="1"&gt;</description></item><item><title>re: Scope chain of JScript Functions</title><link>http://blogs.msdn.com/b/jscript/archive/2007/07/26/scope-chain-of-jscript-functions.aspx#4113077</link><pubDate>Sun, 29 Jul 2007 07:58:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4113077</guid><dc:creator>Kim</dc:creator><description>&lt;p&gt;A very detailed article. This really helped me clarify some doubts. One quick question, does all of it apply to JavaScript in general or some of it is specific to Microsoft's implementation of JavaScript?&lt;/p&gt;
&lt;p&gt;Lastly, I expect to see few more of this knowledge based article in future. &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4113077" width="1" height="1"&gt;</description></item></channel></rss>