写.js函数

时间:2017-03-02 21:54:08

标签: javascript function

我遇到以下.js功能问题。控制台日志给出了以下错误:

  

"消息":"未捕获的SyntaxError:缺少)参数列表",

对于这行:degCent [loopCounter] = convertToCentigrade(degFahren [loopCounter]);

我没有看到另一个")"应该输入 - 谢谢你的帮助。



function convertToCentigrade (degFahren) {
	var degCent = 5/9 * (degFahren -32);
  return degCent;
}

var degFahren = [212, 32, -459.15];
var degCent = [];
var loopCounter;

for (loopCounter = 0; loopCounter <=2; loopCounter ++) {
	degCent[loopCounter] = convertToCentigrade(degFahren[loopCounter]);
}

for (loopCounter = 2; loopCounter >= 0; loopCounter--) {
	document.write ("Value " + loopCounter + " was " degFahren[loopCounter] + " degrees Fahrenheight ");
	document.write("which is " + degCent[loopCounter] + " degrees Centigrade<br />");
}
&#13;
&#13;
&#13;

2 个答案:

答案 0 :(得分:2)

问题在于这一行:

from django.db.models import F
Employee.objects.annotate(boss_salary=F("boss__salary"))\
                .filter(salary__gt=F("boss_salary"))

&#34;&#34;

后需要一个+

答案 1 :(得分:1)

在“是”之后你缺少一个加号

function convertToCentigrade (degFahren) {
	var degCent = 5/9 * (degFahren -32);
  return degCent;
}

var degFahren = [212, 32, -459.15];
var degCent = [];
var loopCounter;

for (loopCounter = 0; loopCounter <=2; loopCounter++) {
	degCent[loopCounter] = convertToCentigrade(degFahren[loopCounter]);
}

for (loopCounter = 2; loopCounter >= 0; loopCounter--) {
	document.write ("Value " + loopCounter + " was " +  degFahren[loopCounter] + " degrees Fahrenheight ");
	document.write("which is " + degCent[loopCounter] + " degrees Centigrade<br />");
}