Can someone please explain to me in simple words what is  the ?: (conditional, "ternary") operator and how to use it?...
How do you do a ternary with AngularJS (in the templates)?  It would be nice to use some in html attributes (classes and style) instead of creating and calling a function of the controller....
How can I use an inline if statement in JavaScript? Is there an inline else statement too?  Something like this:  var a = 2; var b = 3;  if(a < b) {     // do something }...
Can this be done in JavaScript?  type == 1 ? function1() : function2();...
Can I somehow use if-then-else construction (ternary-operator) in angularjs expression, for example I have function $scope.isExists(item) that has to return bool value. I want something like this,  <div ng-repeater="item in items">...
I need a bit of syntax help with a ternary operator which will help me to put the correct marker icons on to my good map.I have three areas 0,1 and 2 which have unique icons 0, 1 and 2.  I used to have just two areas so this ternary operator worked f...
New to javascript and I'm having trouble counting the number of trues in an array of boolean values.  I'm trying to use the reduce() function.  Can someone tell me what I'm doing wrong?     //trying to count the number of true in an array...
Here I am trying to change the value of the following check box while clicking on it. In the code below I tried to change the value of the checkbox to 1 and change the value to 0 when unchecked. But it takes only the false condition, when the checkbo...
the_styles ? the_styles.appendTo('head'); the_styles=null : the_styles = $('.stylesheet').detach();   Obviously, this isn't valid. Notice the ";" between the appendTo() and the_styles=null. How do I write it on 1 line and...
I see a lot of:  var something = (is_something_true()) ? 3 : 4;   in javascript.  Is this faster than  var something; if (is_something_true()) {     something = 3; } else {     something = 4; }   Or is it written concisely for convenience?...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.