<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>mactkg</author_name>
  <author_url>https://blog.hatena.ne.jp/mactkg/</author_url>
  <blog_title>半空洞男女関係</blog_title>
  <blog_url>https://mactkg.hateblo.jp/</blog_url>
  <categories>
    <anon>JavaScript</anon>
    <anon>メモ</anon>
    <anon>プログラミング</anon>
  </categories>
  <description>10回試して条件にあったらおしまいみたいなコードをjsで書くとしたらこんな感じでしょうか． setImmediate(function loop(times, limit) { console.log(times + &quot;/&quot; + limit) if(Math.random() &gt; 0.7) { console.log(&quot;yay!&quot;) return } if(times &lt; limit) { setTimeout(loop, 100, times+1, limit) } }, 0, 10) シンプルで分かりやすいかなあと思います． 追記 Promise返ってきたほうがお洒落だなと思ってやってみた…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmactkg.hateblo.jp%2Fentry%2F2016%2F02%2F11%2F215809&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>2016-02-11 21:58:09</published>
  <title>何回か試してタイムアウト的なコード</title>
  <type>rich</type>
  <url>https://mactkg.hateblo.jp/entry/2016/02/11/215809</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
