I am using the following shorthand conditional in JS/jQuery:
var delay = $(this).data("delay") ? $(this).data("delay") : options.delay;
If the element has a data-delay
attribute use that value, otherwise get the value from options.delay
.
It seems excessive using $(this).data("delay")
two times in the shorthand conditional. Is there a better way to do it?
Would var delay = $(this).data("delay") || options.delay;
be a good solution? I am not sure if all browser supports it.