How do i translate this to "simpler" JavaScript?

Posted by Julian Weimer on Stack Overflow See other posts from Stack Overflow or by Julian Weimer
Published on 2010-05-12T17:29:34Z Indexed on 2010/05/12 17:34 UTC
Read the original article Hit count: 214

Filed under:
|
|

Since i'm working with Titanium i realzed that its current JavaScript Interpreter doesn't accept specific coding-styles.

So for for-loops and if-statements i have to have braces, even though i only want to span one line. Furthermore there is more i have to change if i want to use a Javascript Library like underscore.js. This is what Titanium doesn't want to see:

if (!(result = result && iterator.call(context, value, index, list))) {_.breakLoop();}

if (nativeSome && obj.some === nativeSome) {return obj.some(iterator, context);}

var computed = iterator ? iterator.call(context, value, index, list) : value;

computed >= result.computed && (result = {value : value, computed : computed});

Can i use a simpler syntax to describe the logic behind those lines of code?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about titanium