javascript太牛了,还能模拟函数式编程
好久不写javascript了,今天做一个脚本调用web服务的例子,发现javascript太好了,写出的代码太优雅了,最后我的脚本如下,太漂亮了,js还能模拟函数式编程,啥时候c#也这么灵活就牛了。
function AgreePost(link, postId)
{
WawaSoft.WaTu.Web.AjaxHelperServices.AddPostAgreeHits(postId,
function(result,link){
link.outerHTML = "支持" + result;
},
function(error){
link.outerHTML = error.get_message();
},
link);
}
给大家推荐两篇文章
用函数式编程技术编写优美的 JavaScript
http://www.ibm.com/developerworks/cn/web/wa-javascript.html
用匿名函数避免命名冲突
http://home.wangjianshuo.com/cn/20070515_cec.htm
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
给大家推荐两篇文章
用函数式编程技术编写优美的 JavaScript
http://www.ibm.com/developerworks/cn/web/wa-javascript.html
用匿名函数避免命名冲突
http://home.wangjianshuo.com/cn/20070515_cec.htm