我负责一个JavaScript web应用程序。这是非常复杂的,而且我遇到一些麻烦语法:Javascript变量声明语法
getThemeBaseUrl = function() {
var customConfigPath = "./customer-configuration";
if (parseQueryString().CustomConfigPath) {
customConfigPath = parseQueryString().CustomConfigPath;
}
var clientId = parseQueryString().ClientId;
return customConfigPath + "/themes/" + clientId;
};
parseQueryString = function() {
var result = {}, queryString = location.search.substring(1), re = /([^&=]+)=([^&]*)/g, m;
while (m = re.exec(queryString)) {
result[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
}
return result;
};
特别
parseQueryString().CustomConfigPath
和var result = {}, queryString = location.search.substring(1), re = /([^&=]+)=([^&]*)/g, m;
第一似乎是一种由parseQueryString功能属性访问。
第二个看起来是数组声明,但没有Array()构造函数。此外,m
值在while循环中没有推测的数组结果时被调用。