I need some clarification on this statement “return a === b ? 0 : a < b ? 1 : -1;” inside the below function, please.
function reverseAlpha(arr) {
return arr.sort(function(a, b) {
return a === b ? 0 : a < b ? 1 : -1;
});
}
I need some clarification on this statement “return a === b ? 0 : a < b ? 1 : -1;” inside the below function, please.
function reverseAlpha(arr) {
return arr.sort(function(a, b) {
return a === b ? 0 : a < b ? 1 : -1;
});
}
That’s a nested ternary.
Ternaries are introduced here:
Multiple ternaries are introduced here:
@mukhtar-github It looks like you have a test statement in your conditional (ternary) operator where there should not be.
Thank you . I will go through the link you provided.
Thank you. I will go through the links you provided.
Thank you. I appreciate your effort Mr Randell Dawson.