Why won't yield return from within a `.map` callback?
问题 Learn Generators - 4 » CATCH ERROR! The solution uses a for loop but I just couldn't find anything in MDN - Iteration Protocols that refers to yield within callbacks. I'm going to guess the answer is just don't do that but thanks in advance if anyone has the time or inclination to provide an explanation! Code: function *upper (items) { items.map(function (item) { try { yield item.toUpperCase() } catch (e) { yield 'null' } } } var badItems = ['a', 'B', 1, 'c'] for (var item of upper(badItems))