Having some issue with nested ternary :
I have code :
var genericName = Beauty;
setTitle = (!empty(shopOnline) ? shopOnline + ' | ' : '')
+ (!empty(productName) ? productName + ' | ' : '')
+ genericName;
I want scenario like:
- if genericName is not empty - Shop Online | Product Name | Generic Name
- if genericName is empty - Shop Online | Product Name
Currently I am getting the output of my code (if genericName is empty) - Shop Online | Product Name |
How we can add the nested ternary operator to remove " | " if genericName is empty after Product Name ( (!empty(productName) ? productName + ' | ' : '') )