I have the following code:
let visiblePart = $(this).data('visible-part');
if (visiblePart === undefined)
visiblePart = 0.5;
I'd like to merge requesting the data-visible-part value with checking for its existence to make the code more compact. Unfortunately, there is no overload of .data() with a defaultValue parameter. How to achieve this?