function getCommonCategory() {
var grade = document.getElementById("grade").value;
var quizType = document.getElementById("quizType").value;
var moduleNumber = document.getElementById("moduleNumber").value;
var assignmentNumber = document.getElementById("assignmentNumber").value;
var category = "$CATEGORY: $course$/Default for " + grade;
if (moduleNumber == "")
alert("Enter the module number, please!");
var shortType = "";
if (quizType == "Homework")
shortType += "HW";
else
if (quizType == "Classwork")
shortType += "CW";
else
shortType += "QZ";
category += shortType + "/" + grade + " - Module " + moduleNumber + "/";
category += shortType + " - " + assignmentNumber + "/";
return category;
我正在WebStorm中做一个项目,我有这个单独的JS文件,我有这个功能。但是,我不断收到一条警告消息,指出返回的表达式类型字符串不可分配以键入。 (它没有显示其余部分)
我也有这个功能:
function getListeningGift() {
var cat = getCommonCategory();
var win = window.open("");
win.writeln(cat);
}
并且WebStorm在其中说:参数类型不能分配给类型字符串
我无法理解这里的问题。那是什么?