Path: csiph.com!news.redatomik.org!aioe.org!.POSTED!not-for-mail From: emf Newsgroups: comp.lang.javascript Subject: JSlint finds for loops intolerable Date: Sun, 28 Aug 2016 06:56:41 -0400 Organization: Aioe.org NNTP Server Lines: 37 Message-ID: NNTP-Posting-Host: 3ISyn0wuzvJJ1XgLc/VXoQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 X-Mozilla-News-Host: news://news.aioe.org:119 X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.javascript:31190 In the current JSLint help webpage (http://jslint.com/help.html) it now says: "Tolerate for statement: true if the for statement should be allowed It is almost always better to use the array methods instead." Getting rid of the for loops is a big change. Reflecting on it, however, the for loop is an awkward construction -- it's just something you learn as a matter of fact when you begin and that time on you take it for granted. Instead of for (var i = 0; i < 10; i += 1) { ... } the while loop does seem more straightforward: var i = 0; while (i < 10) { ... i += 1; } After stopping using for loops, I can imagine a time when I won't be able to understand why I once almost always preferred to use them. I do not understand, however, the comment about array methods. I seldom find use for them. Can someone explain what Crawford implies?? Thanks. Eustace -- The folk oratorios of Mikis Theodorakis http://emf.neocities.org/mt/folkoratorios.html