Subject: Life Insurance Policy - (1) New Update

From: Policy Payout Provisions <[email-masked]>
Date: Tue, 01 Jul 2014 08:52:13 -0700

ATTN Policy Holder: Ipp-archive
Group Policy Number: 57-6454133
RE: Schedule of Benefits; June Provisions

Eligibility Update -

You have reached a life milestone which now qualifies you for a low Term-Life Rate.

View Rate Here: http://www.fleecearound.com/policy/details.html

Rate Generated on: June 30, 2014

[The $500,000k payout is available]

** To View Definitions of all terms used in this summary: Click Here http://www.fleecearound.com/policy/details.html

We hope you found this policy update useful. 
To modify notification settings - write "stop" to Current Update Alerts
1644 Doral Dr_Brookings, SouthDakota 5 7 0 0 6 or visit http://www.fleecearound.com/ikke.ek494

If you want to break the loop, you can use some. (I would have preferred allowing breaking forEach as well, but they, um, didn't ask mecompletely agree that forEach should have had a way to stop. Those use cases far exceed the ones where you want to use a function that may return the magic "stop" value when you want to stop (and so you have to wrap them in a function), which is the only reason I can see for not giving forEach's iterator a stop value it can return. if you're using ie8 you can paste in this code to use forEach. if ( !Array.prototype.forEach ) { Array.prototype.forEach = function(fn, scope) { for(var i = 0, len = this.length That's a seriously incorrect implementation of forEach. Important lesson here: Just because it's on MDN, doesn't mean it's good. Agreed: this is a better answer and should be the accepted one although it would be better if it included a e. Also note that the one in the edit you suggested (I didn't see it until after the edit was already rejected) is
  not at all what the specification defines for forEach.  Please don't add redundant/unnecessary links to the answer. I explain that value perfectly well aboremember not to create global variables for local use in a loop. use: for (var key in a) If that code is at global scope, it creates a global variable called key. var does not have block or statement scope in JavaScript. More: Poor misunderstood var I didn't know that! thanksindex and not index++? The first key should be 0. Where I'm using it above, it doesn't make any difference whether it's ++index or index++; we're not using the result of that expression. The first value index will have in the loop is 0 either way. I used ++index because I speak English, and so "increment index" makes more sense to me than "index increment". But whichever you prefer is fine thereder Thanks, I didn't know it didn't make any difference in a for() loop argument. I have a doubt on example 3 you said it will loop only 3 times but actually it does l
 oop 10001 times and printed the 3 items. Am I missing something?  No, it doesn't. Did you try it? Walk through it with a debugger? Or perhaps add a console.log inside the for-in but not inside the if? Because the array is sparse, it only has three property names (keys, indexes), so for-in only does three loops.  yes I put console before the if statement and it did print other attributes (prototype of array i believe), sorry mistaken as 10001 prints. I'm using firebug.I think there must be an error in your test code. If you take Example 3 and copy it verbatim, adding a line to log the keys that get filtered out (there won't be any, in a normal environment), you get this: for the for-in explain   ahaps the Object.keys() using a for or a while loop approach should be added? It would also work well for sparse arrays Using Object.keys on an array and then using forEach on the resulting array of keys is a fairly roundabout way to do #1 above, but adds the problem that you'd also see the n
 on-entry properties (the way you do with for-in, but not including prototype properties). When is it useful to do that rather than just use forEach directly on the array?  I only suggested considering it for completeness' sake. I didn't say it was useful or