-1
我想要一個函數來返回我經常使用的條件語句的參數,但是我無法得到如何在字符串內匹配函數參數。下面是函數:JS:如何將函數參數包含到大塊字符串中
function conditionForLinks(textNum, linkNum){
return "${typeof(contentAsset.custom.brandInfoLinkUrl+textNum) !== 'undefined' && contentAsset.custom.brandInfoLinkUrl+textNum &&
typeof(contentAsset.custom.brandInfoLinkText+linkNum) !== 'undefined' && contentAsset.custom.brandInfoLinkText+textNum}"
}
的typeof(contentAsset.custom.brandInfoLinkUrl + textNum) - 這是什麼應該是什麼? :P – nowhere
它是demandware腳本,ds是電子商務平臺 –
是contentAsset.custom.brandInfoLinkUrl應該是一個數字嗎? – nowhere