Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Rolf Niepraschk Newsgroups: comp.lang.javascript Subject: Re: Iterating through an array (special syntax) Date: Thu, 19 Oct 2017 15:15:15 +0200 Lines: 38 Message-ID: References: <7f583c52-91a8-4773-a2cb-bc8534a1ad78@googlegroups.com> <22557651-daf7-4252-b3a4-c9df083be85c@googlegroups.com> <526590a8-1952-4da6-a8cd-525eef79df6f@googlegroups.com> Reply-To: Rolf.Niepraschk@gmx.de Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net dNTX8oXelV9SbLr/ugdbwwNMg+XGri3lYCHid4bh+4SrzGyxbo Cancel-Lock: sha1:jeSmsamEH4fdIqS0t+Ed1p9stko= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 In-Reply-To: <526590a8-1952-4da6-a8cd-525eef79df6f@googlegroups.com> Content-Language: en-US Xref: csiph.com comp.lang.javascript:34132 Now I have found a solution by myself (old fashion syntax): //===================================================== function foo() { var fn_done, fn_each; var ctx = { done:function(fn) {fn_done = fn; return this;}, each:function(fn) {fn_each = fn; return this;} } setTimeout(function() { var oldItems = [1,2,3,4], newItems = oldItems.map(function(x) {return x * 2}); if (typeof fn_each == 'function') { for (var i=0; i