Yes, var item = e[i].OurRating; was the answer, thanks.
On Monday, June 8, 2015 at 10:33:05 PM UTC-6, ryandesign wrote: > > > On Jun 8, 2015, at 12:56 PM, JBD wrote: > > > I am trying to loop through an array and change the value of a field in > a node.js controller. How do I do this? > > > > item.fetch({ > > onerror: function() { > > res.status(404).end(); > > }, > > success: function() { > > var e = item.toJSON(); > > for (var i in e) { > > e.OurRating = > e.OurRating*10).toFixed(0);; > > > Here, did you mean "i.OurRating" instead of "e.OurRating"? > > Of course, you've got other typos, like the mismatched close parenthesis > and the second trailing semicolon. > > > } > > viewData.Item = e; > > render(req, res, 'page', > viewData); > > } > > }); > > -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. To post to this group, send email to nodejs@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/a9d6fa52-20ba-4452-acb8-557137f39ac0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.