Add foreach loop in knockout

I am using the following condition and its print one value,

if(self.options.nearestlocationsBlock) { var firstStore = _.first(locations.items); var newContent = '<div class="store"> <div class="zipcode">'+firstStore.address+','+firstStore.city+','+firstStore.state+','+firstStore.zip+'</div></div>'; self.storeListIdentifier.html(newContent); } 

I want to print the next three values, how to do that?

eg: I am print first value, i want to print next three values in second condition, how to do that?

Workout:

I am trying following script, its return but keep page loading,

if(self.options.nearestlocationsBlock) { var firstStore = locations.items; firstStore.foreach(function(firstStore){ var newContent = '<div class="store"> <div class="zipcode">'+firstStore.address+','+firstStore.city+','+firstStore.state+','+firstStore.zip+'</div></div>'; self.storeListIdentifier.html(newContent); }); 

submitted by /u/aveeva7
[link] [comments]