There is a nested function (a function inside a function) that looks something like this along with some tests that I added:
function addImage( ....., borderColor){
var height;
var width;
var imageObj = new Image();
alert(' just before inner function is: ' + borderColor);
imageObj.onload = function(){
alert(' just after inner function is: ' + borderColor);
The first alert shows the correct color, but the second alert is ‘null’.
How can I get the variable borderColor inside of the nested function?
test case here it works fine for me
alert(' just after inner function is: ' + borderColor);part ?borderColoris not used elsewhere ?