javascript - SyntaxError: missing ) 在形式参数之后。当我使用正确的语法时,这个错误是什么意思?
问题描述
function placeValues(int low, int high, int[] a, int loc){
if(a[loc] == null){
int mid = ((high - low)/2) + low;
a[loc] = mid;
placeValues(mid, high, a, loc+1);
placeValues(low, mid, a, loc+2);
}
}
function createColor(){
for(int i = 0; i<256; i++){
colorArray[i] = "rgb( 0, 0, " + i + ")";
}
for(int j = 0; j<76; j++){
colorArray[256+j] = "rgb( 0, 255, " + (j+180) + ")";
}
locations[0] = 0;
locations[1] = 301;
placeValues(0, 301, locations, 3);
}
function getColor(index){
createColor();
index = index % colorArray.length;
colorArray[locations[index]];
}
这是我的以下代码。它继续发出 SyntaxError(如标题所示)(错误出现在第一行:function placeValues(~){)。数组位于父 html 文件中,该文件也使用 javascript 进行编码。
有人可以帮我理解 SyntaxError 的含义。我原本以为这只是在抱怨,因为我的变量位于 HTML 文件中,但显然这些变量是在 javascript 下编码的。
有什么想法吗?
解决方案
推荐阅读
- javascript - 根据选择的选项更改存在规则
- java - Java & MySQL - setBoolean() 方法出错
- django - 使用带有注解的 Django CheckConstraint
- python - 读取每个 url 并将其保存到单独的 pdf Python
- xamarin - 从一个详细信息页面到另一个详细信息页面时如何保存页面上的信息
- javascript - React Hooks 上的 useState 不更新数组
- python - 如果某些值是 NaN,我如何对 DataFrame 中的 2 个特定列行求和?
- angular - Ionic 4 - 在指令上获取 ElementRef 属性
- vue.js - 由于重复“请运行 npm install -g @vue/cli-upgrade 并重试”,无法升级 vue cli。
- database - 如何从 DataGridView 编辑行?MS Access 数据库