<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Javascript: Passing functions around with call and apply</title>
	<atom:link href="http://www.markhneedham.com/blog/2010/02/12/javascript-passing-functions-around-with-call-and-apply/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.markhneedham.com/blog/2010/02/12/javascript-passing-functions-around-with-call-and-apply/</link>
	<description>Thoughts on Software Development</description>
	<lastBuildDate>Wed, 08 Sep 2010 21:07:07 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Mark Needham</title>
		<link>http://www.markhneedham.com/blog/2010/02/12/javascript-passing-functions-around-with-call-and-apply/comment-page-1/#comment-32244</link>
		<dc:creator>Mark Needham</dc:creator>
		<pubDate>Sat, 20 Feb 2010 11:20:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=2141#comment-32244</guid>
		<description>@Nick - yeh I think you&#039;re right that would work better. Not sure why I didn&#039;t see that!</description>
		<content:encoded><![CDATA[<p>@Nick &#8211; yeh I think you're right that would work better. Not sure why I didn't see that!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick</title>
		<link>http://www.markhneedham.com/blog/2010/02/12/javascript-passing-functions-around-with-call-and-apply/comment-page-1/#comment-32204</link>
		<dc:creator>Nick</dc:creator>
		<pubDate>Fri, 19 Feb 2010 17:55:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=2141#comment-32204</guid>
		<description>Couldn&#039;t you just as easily pass the result of the called function to assertEquals?

TestCase(&quot;Common&quot;, {
    testShouldDoSomeStuff:function(){
		var common = new Common();
		assertEquals(&quot;expected value&quot;,common.Method(&quot;some value&quot;));
		assertEquals(&quot;expected value&quot;,common.Method(&quot;some value&quot;));
    }
};</description>
		<content:encoded><![CDATA[<p>Couldn't you just as easily pass the result of the called function to assertEquals?</p>
<p>TestCase("Common", {<br />
    testShouldDoSomeStuff:function(){<br />
		var common = new Common();<br />
		assertEquals("expected value",common.Method("some value"));<br />
		assertEquals("expected value",common.Method("some value"));<br />
    }<br />
};</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: The Morning Brew - Chris Alcock &#187; The Morning Brew #539</title>
		<link>http://www.markhneedham.com/blog/2010/02/12/javascript-passing-functions-around-with-call-and-apply/comment-page-1/#comment-31938</link>
		<dc:creator>The Morning Brew - Chris Alcock &#187; The Morning Brew #539</dc:creator>
		<pubDate>Mon, 15 Feb 2010 08:36:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=2141#comment-31938</guid>
		<description>[...] Javascript: Passing functions around with call and apply - Mark Needham looks at the difficulties in using &#8216;this&#8217; in JavaScript, and shows how the Call and Apply methods help in this regard. Mark also shares a bit of information about a number of other JavaScript related thing he learnt this week in his post Javascript: Some stuff I learnt this week [...]</description>
		<content:encoded><![CDATA[<p>[...] Javascript: Passing functions around with call and apply &#8211; Mark Needham looks at the difficulties in using 'this' in JavaScript, and shows how the Call and Apply methods help in this regard. Mark also shares a bit of information about a number of other JavaScript related thing he learnt this week in his post Javascript: Some stuff I learnt this week [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: MLN</title>
		<link>http://www.markhneedham.com/blog/2010/02/12/javascript-passing-functions-around-with-call-and-apply/comment-page-1/#comment-31847</link>
		<dc:creator>MLN</dc:creator>
		<pubDate>Sat, 13 Feb 2010 05:06:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=2141#comment-31847</guid>
		<description>you would not need call/apply if u do this.
function Common() {
        var self = this;
	this.OtherMethod = function(value) {
		// do some manipulation on value
		return someMagicalNewValue;	
	};
 
	this.Method = function(value) {
		return self.OtherMethod(value);	
	};
 
};

and always use &#039;self&#039; to refer to common.</description>
		<content:encoded><![CDATA[<p>you would not need call/apply if u do this.<br />
function Common() {<br />
        var self = this;<br />
	this.OtherMethod = function(value) {<br />
		// do some manipulation on value<br />
		return someMagicalNewValue;<br />
	};</p>
<p>	this.Method = function(value) {<br />
		return self.OtherMethod(value);<br />
	};</p>
<p>};</p>
<p>and always use 'self' to refer to common.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
