なあ、再帰関数好きな人いる? パート3 [転載禁止]©2ch.net (914レス)
なあ、再帰関数好きな人いる? パート3 [転載禁止]©2ch.net http://mevius.5ch.net/test/read.cgi/tech/1448704298/
上
下
前次
1-
新
通常表示
512バイト分割
レス栞
抽出解除
必死チェッカー(本家)
(べ)
自ID
レス栞
あぼーん
リロード規制
です。10分ほどで解除するので、
他のブラウザ
へ避難してください。
144: デフォルトの名無しさん [sage] 2015/12/14(月) 21:30:28.83 ID:lwFUcSQC function NodeIterator(node, childNodesName) { this._stack = [node]; this._name = childNodesName; } NodeIterator.prototype.hasNext = function() { return this._stack.length > 0; } NodeIterator.prototype.next = function() { var node = this._stack.pop(); if (node) { for (var i = node[this._name].length -1; i > -1; --i) { this._stack.push(node[this._name][i]); } } return node; } ノードの親や深さも欲しい時は、スタックに積むノードをオブジェクトでラップして親の参照や深さを持たせればいいかも http://mevius.5ch.net/test/read.cgi/tech/1448704298/144
メモ帳
(0/65535文字)
上
下
前次
1-
新
書
関
写
板
覧
索
設
栞
歴
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
AAサムネイル
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.034s