我一直在使用Vector2和XNA,并且我发现调用零向量上的Normalize()成员函数会将其归为{NaN,NaN}向量。这一切都很好,但在我的情况下,我宁愿它,而只是把它们作为零向量。 将此代码添加到我的项目启用了一个可爱的扩展方法: using ExtensionMethods;
namespace ExtensionMethods
{
public static class
var UI$Contract$ddlForm_change = function() {
//'this' is currently the drop down that fires the event
// My question is can I change the context so "this" represents another object?
t
我有以下几点: var o = {f: function(fn) {
fn.call(o);
}};
var ob = {f: function() {
o.f(function() {
this.x = 2; //HERE: how can this reference ob?
//ob.x = 2;
});
}};
ob.f();