<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[פרומיס שעוטף פרומיס]]></title><description><![CDATA[<pre><code>function valTimeout (val, ms) {
  return new Promise((resolve) =&gt; setTimeout(() =&gt; resolve(val), ms))
};
const res = await valTimeout(valTimeout(1, 10000), 1000);
console.log(res);
</code></pre>
<p dir="auto">מה הקוד הזה מדפיס ואחרי כמה זמן?</p>
<p dir="auto">(תנסה לחשוב לבד, אח"כ תבדוק בקונסול אם צדקת. אני לא צדקתי בניחוש שלי...)</p>
]]></description><link>https://tchumim.com/topic/11440/פרומיס-שעוטף-פרומיס</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Apr 2026 20:29:48 GMT</lastBuildDate><atom:link href="https://tchumim.com/topic/11440.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 25 Jun 2021 08:25:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to פרומיס שעוטף פרומיס on Sun, 27 Jun 2021 15:50:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/aaron">@<bdi>aaron</bdi></a> לא מובן מה שאתה טוען. איזה התנהגות מזמינה באגים?</p>
]]></description><link>https://tchumim.com/post/124647</link><guid isPermaLink="true">https://tchumim.com/post/124647</guid><dc:creator><![CDATA[yossiz]]></dc:creator><pubDate>Sun, 27 Jun 2021 15:50:53 GMT</pubDate></item><item><title><![CDATA[Reply to פרומיס שעוטף פרומיס on Sun, 27 Jun 2021 16:08:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dovid">@<bdi>dovid</bdi></a> בעצם אני תופס שתמיד ידעתי את זה בתת המודע.<br />
אותה שאלה אפשר לשאול בתחביר ה-then-י:</p>
<pre><code>Promise.resolve(Promise.resolve(1)).then(console.log)
</code></pre>
<p dir="auto">כבר אלף פעמים כבר כתבתי קוד שמבוסס על זה שה-then מקבל את הערך הסופי גם של הפרומיס הפנימי.<br />
משום מה השאלה הזאת בלבלה אותי...</p>
]]></description><link>https://tchumim.com/post/124646</link><guid isPermaLink="true">https://tchumim.com/post/124646</guid><dc:creator><![CDATA[yossiz]]></dc:creator><pubDate>Sun, 27 Jun 2021 16:08:54 GMT</pubDate></item><item><title><![CDATA[Reply to פרומיס שעוטף פרומיס on Fri, 25 Jun 2021 13:29:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dovid">@<bdi>dovid</bdi></a> אמר ב<a href="/post/124597">פרומיס שעוטף פרומיס</a>:</p>
<blockquote>
<p dir="auto">הawait מחכה בשרשרת עד שהערך הסופי לא יהיה בר המתנה</p>
</blockquote>
<p dir="auto">מריח כמו התנהגות שמזמינה באגים (או רק חוסר הבנה נכון של איך הקוד רץ)..</p>
]]></description><link>https://tchumim.com/post/124606</link><guid isPermaLink="true">https://tchumim.com/post/124606</guid><dc:creator><![CDATA[aaron]]></dc:creator><pubDate>Fri, 25 Jun 2021 13:29:57 GMT</pubDate></item><item><title><![CDATA[Reply to פרומיס שעוטף פרומיס on Fri, 25 Jun 2021 09:29:55 GMT]]></title><description><![CDATA[<p dir="auto">המחשה אלגנטית יותר</p>
<pre><code>await Promise.resolve(Promise.resolve(1)) == 1
</code></pre>
]]></description><link>https://tchumim.com/post/124599</link><guid isPermaLink="true">https://tchumim.com/post/124599</guid><dc:creator><![CDATA[dovid]]></dc:creator><pubDate>Fri, 25 Jun 2021 09:29:55 GMT</pubDate></item><item><title><![CDATA[Reply to פרומיס שעוטף פרומיס on Fri, 25 Jun 2021 09:09:41 GMT]]></title><description><![CDATA[<p dir="auto">טעיתי... חשבתי שיהיה מודפס <code>Promise &lt;pending&gt;</code><br />
הawait מחכה בשרשרת עד שהערך הסופי לא יהיה בר המתנה</p>
<pre><code>(await new Promise(x =&gt; x(new Promise(y =&gt; y(1))))) == 1
</code></pre>
]]></description><link>https://tchumim.com/post/124597</link><guid isPermaLink="true">https://tchumim.com/post/124597</guid><dc:creator><![CDATA[dovid]]></dc:creator><pubDate>Fri, 25 Jun 2021 09:09:41 GMT</pubDate></item></channel></rss>