Copy link to clipboard
Copied
Dear Member,
Could you please check what is the difference between both the snippet?
First one is giving wrong output.
Sumit
parentPage = (prevPageItem && prevPageItem.parentPage.documentOffset >= element.getParentPage().documentOffset) ?
prevPageItem.parentPage :
(element.getParentPage().documentOffset > firstPage.documentOffset) ?
element.getParentPage() :
document.pages.item(parentPage.documentOffset + 1);
parentPage = (function () {
if (prevPageItem && prevPageItem.parentPage.documentOffset >= element.getParentPage().documentOffset)
return prevPageItem.parentPage;
else if ((elementParentPage = element.getParentPage()).documentOffset > firstPage.documentOffset)
return elementParentPage;
else return document.pages.item(firstPage.documentOffset + 1);
}).call();
VS
Hi,
I am not sure what is different but I would guide against using nested ternary methods as this makes the code harder to follow, therefore I would always recommend that you use the second option, in terms of coding style.
Copy link to clipboard
Copied
Hi,
I am not sure what is different but I would guide against using nested ternary methods as this makes the code harder to follow, therefore I would always recommend that you use the second option, in terms of coding style.
Copy link to clipboard
Copied
Thank you BarlaeDC.