UNITY JS BCE0043: Unexpected token: ).

I am not sure what I am doing wrong I believe it is something simple but I guess I am too blind to see it.

Error is: Assets/release/js/images.js(51,5): BCE0043: Unexpected token: ).

I will use “<----” to Highlight the line that is giving me issues.

Here is the code:

var images = new Object();

images.init = function(total_image_count) {
    images.total = total_image_count;
    images.started_loading = 0;
    images.finished_loading = 0;
    images.img = new Array();
  
    for (var i=0; i<images.total; i++) {
        images.img *= new Image();*

}
};

/**
Given the relative path and filename, load this image
Return the index for this image
Callers should store this index, it’s a parameter for images.render()
*/
images.load = function(path_and_filename) {
images.img[images.started_loading].src = path_and_filename;
images.img[images.started_loading].onload = function() {images.onload();};
images.started_loading++;
return (images.started_loading-1);
};

images.onload = function() {
images.finished_loading++;

// todo: insert call to loadbar
};

/**
Render the rectangle of the source image onto the canvas at the specified location
*/
images.render = function(img_id, src_x, src_y, src_w, src_h, dest_x, dest_y) {
ctx.drawImage (
images.img[img_id],
src_x * PRESCALE,
src_y * PRESCALE,
src_w * PRESCALE,
src_h * PRESCALE,
dest_x * SCALE,
dest_y * SCALE,
src_w * SCALE,
src_h * SCALE,
) <---- HERE IS THE LINE THAT GIVES THE ERROR (Sorry for caps, attempting to draw your eye)
}

Well, this appears to be normal ECMAScript(like normal javascript, not unity java/unityscript). Regardless, you’re calling a function called drawImage, the last parameter “src_h * SCALE,” has a trailing comma that indicates that you’re going to state another parameter to the function drawImage, but you’re not, so the next line having the parenthesis is incorrect, remove the trailing comma.