How to use return in ternary operator in jQuery?
myfunc: function() {
for(i = 0; i < 10; i++) {
(6 == i) ? Do_This_and_This : return true;
}
//Error: Expected an operand: but found return false or true.
}
As per understanding return false will return back to function and breaks the loop and return true will work as continue which moves to next iteration.
Please validate understanding and provide solution for same. If there is another way to do it please suggest
UPDATE: My solution have big javascript and i have put small snippet for an instance that what it is doing.
Like in for there are nested ifs` and nested ternary operators too. Lets give more snippet
myfunc: function() {
for(i = 0; i < 10; i++) {
($.inArray(questionNumber, questions) > -1) ? ((Ra === ) ? Report= Report+<tr><td>lakslak</td></tr> : Report= Report+<tr><td>lasaaakslak</td></tr>) : return false;
}
}