over-recursion-with-leaf-nodes.js (489B)
1 function hasChildNodes() { 2 // Recurse so we get close to the stack limit. 3 try { 4 hasChildNodes(); 5 } catch { 6 // Ignore over-recursion error. 7 } 8 9 // RegExp with child nodes. 10 return RegExp(".|.").test(""); 11 } 12 hasChildNodes(); 13 14 function hasLeafNode() { 15 // Recurse so we get close to the stack limit. 16 try { 17 hasLeafNode(); 18 } catch { 19 // Ignore over-recursion error. 20 } 21 22 // RegExp consisting of a single leaf node. 23 return RegExp(".").test(""); 24 } 25 hasLeafNode();