<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>panda_noir</author_name>
  <author_url>https://blog.hatena.ne.jp/panda_noir/</author_url>
  <blog_title>Panda Noir</blog_title>
  <blog_url>https://www.pandanoir.info/</blog_url>
  <categories>
    <anon>JavaScript</anon>
  </categories>
  <description>何に使えるかは全然わからないですが発見したのでメモ。 まず循環参照を持った配列を定義します。 const a = []; a[0] = a; a[1] = 0; これの flat を呼ぶと面白いことが起きます。 console.log(a.flat()); // [ &lt;ref *1&gt; [ [Circular *1], 0 ], 0, 0 ] console.log(a.flat().flat()); // [ &lt;ref *1&gt; [ [Circular *1], 0 ], 0, 0, 0 ] console.log(a.flat().flat().flat()); // [ &lt;ref *1&gt; […</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fwww.pandanoir.info%2Fentry%2F2023%2F04%2F17%2F183918&quot; title=&quot;循環参照がある配列で flat を呼び出すとどんどん長くなる - Panda Noir&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>2023-04-17 18:39:18</published>
  <title>循環参照がある配列で flat を呼び出すとどんどん長くなる</title>
  <type>rich</type>
  <url>https://www.pandanoir.info/entry/2023/04/17/183918</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
