views:

85

answers:

1

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?

A: 

It looks concise but result = result ? Why is that? other than that your syntax looks simple. Also your code looks verbose and may be easily understandable than a more concise form.

Teja Kantamneni
Pointy
i forgot to mention that it is not my code, i'm trying to make the "underscore.js" library work in Appcelerator Titamium.You can google it to take a look at the code
Julian Weimer