[問題] 請問return function的意義
程式碼請參考 http://jsbin.com/sirotikujicu/1/edit?html,output
這個程式主要是用來讓使用者點選google map上的marker之後,
跳出一個infowindow,然後顯示其文字。
其中有一段
google.maps.event.addListener(marker,'click', function(content){
return function() {
infowindow.setContent(content);//set the content
infowindow.open(map,this);
}
}(content));
請問這一段第2行為什麼要用return function ,跟第4行的this有關嗎?
禮拜六參考google大神寫的,
但是現在竟然看不懂了 = =|||
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.114.69.226
※ 文章網址: http://www.ptt.cc/bbs/Ajax/M.1408957694.A.C67.html
推
08/25 21:53, , 1F
08/25 21:53, 1F
推
08/25 23:39, , 2F
08/25 23:39, 2F
推
08/25 23:42, , 3F
08/25 23:42, 3F
推
08/26 00:05, , 4F
08/26 00:05, 4F
→
08/26 00:06, , 5F
08/26 00:06, 5F
→
08/26 00:06, , 6F
08/26 00:06, 6F
→
08/26 00:07, , 7F
08/26 00:07, 7F
→
08/26 00:07, , 8F
08/26 00:07, 8F
→
08/26 00:08, , 9F
08/26 00:08, 9F
→
08/27 12:09, , 10F
08/27 12:09, 10F
討論串 (同標題文章)
完整討論串 (本文為第 1 之 2 篇):