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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/5E4F751D-CC34-439B-B88B-AC2E6BEE027C%40ryandesign.com.
For more options, visit https://groups.google.com/d/optout.