首页 > 解决方案 > 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 下编码的。

有什么想法吗?

标签: javascripthtmlsyntax-error

解决方案


推荐阅读