Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Code seems to be logical but returns empty string
Message
From
29/07/2015 10:40:00
 
General information
Forum:
Javascript
Category:
Debugging
Miscellaneous
Thread ID:
01622609
Message ID:
01622644
Views:
42
This message has been marked as a message which has helped to the initial question of the thread.
>>>Well, I already re-wrote the code. I was mostly interesting in the explanation of that behavior.
>>
>>Without the brackets the value being tested by the '?' is formTitle+$scope.isNew - that results in a string which is cast to a Boolean. Any non-empty string evaluates to true.
>
>In other words, the + operator takes precedence over the iif operator. This is important to know and keep in mind. Somehow it was not very clear to me.

That's standard left-to-right precedence.
The weird bit is that javascript casts an empty string to false and a non-empty string to true....
Previous
Reply
Map
View

Click here to load this message in the networking platform