我想确保在指定链接函数中的指定参数(将采用数组)始终采用小写值的数组。如果它是大写的,那么在运行newLinks变量之前它应该是小写的。所以这两个参数都像[" aaa"," ccc"," sss"]和[" AAA"," CCC&#34 ;," SSS"]最初都将作为数组传递,但在运行该函数时会小写。这里的关键是我希望大写功能发生在designationLinks函数中。
JS
var designationLinks = function(themeData, designations) {
var newLinks = designations.map(function(agentDesignations){
return '<a class = "designation-box" data-toggle = "modal" data-target = "#'
+ agentDesignations + '-modal" data-value = '
+ agentDesignations + '>' + themeData[agentDesignations + "_name"] + '</a>';
});
return newLinks.join("\n");
};