<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>prime503</author_name>
  <author_url>https://blog.hatena.ne.jp/prime503/</author_url>
  <blog_title>犬も歩けば棒も歩く</blog_title>
  <blog_url>https://prime503.hatenadiary.org/</blog_url>
  <categories>
    <anon>JavaScript</anon>
  </categories>
  <description>無名関数を使ったブロックスコープ化の弱点 JavaScriptではfor文の中やwhile文のなかだけで有効なブロックスコープは存在せず、varを使ってもスコープはその関数内全体で有効になる。これを防ぐ手段として無名関数を使う方法がある。しかしその方法にも弱点があった。クラス内で無名関数を定義した場合、thisが指すものが予期しないものになってしまう。 これだとvar iは関数全体からアクセスできる for(var i = 0 ; i &lt; array.length ; i++){ array[i]に対する処理 } これを防ぐ方法として(function{ … })();で囲む方法がある。 (f…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fprime503.hatenadiary.org%2Fentry%2F20090201%2F1233520732&quot; title=&quot;無名関数を使ったブロックスコープ化の弱点 - 犬も歩けば棒も歩く&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2009-02-01 05:38:52</published>
  <title>無名関数を使ったブロックスコープ化の弱点</title>
  <type>rich</type>
  <url>https://prime503.hatenadiary.org/entry/20090201/1233520732</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
