pav
9/3/2013 - 6:14 PM

alertX in $.proxy(alertX,o) is without braces (the braces will end up calling the function).

alertX in $.proxy(alertX,o) is without braces (the braces will end up calling the function).

var o = {'x':6};

var x = 9;

function alertX() {
    alert(this.x);
}

//use proxy so that calling alertX() will alert the value
// of o.x (currently 6), not x in the global scope (currently 9)

var $proxiedAlertX = function(){
$.proxy(alertX,o);
}

$proxiedAlertX()