2649. Nested Array Generator
https://leetcode.com/problems/nested-array-generator
Javascript
var inorderTraversal = function*(arr) {
for(let item of arr) {
if(Array.isArray(item)) {
for(let sub of inorderTraversal(item)) {
yield sub
}
} else {
yield item
}
}
};