0
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]];
}

Here is my following code. It continues to send out the SyntaxError (shown in title)(the error appears on the first line: function placeValues(~){). The arrays are located in a parent html file that are also coded under javascript.

Could someone help me understand what the SyntaxError means. I origionally thought it was only complaining because my variables are located in a HTML file but apparently the variables are coded under javascript.

Any thoughts?

khelwood
  • 55,782
  • 14
  • 81
  • 108
  • Does `javascript` define the types of the parameters (e.g., `int`)? I thought it would be `placeValues(low, high, a, loc)`. Did this method get copied from `Java`? – KevinO Oct 11 '18 at 15:25
  • 1
    Possible duplicate of [Set type for function parameters?](https://stackoverflow.com/questions/8407622/set-type-for-function-parameters) – KevinO Oct 11 '18 at 15:26

0 Answers0