我可以在 Javascript 中做一些自动转换它的东西吗:
var x = 0;
进入以下(但仅在内存中-我不想更改“查看源”):
var x = {Value: 0};
举个例子:
var x = { Value: 0 };
function a(x) //This function doesn't work if the parameter is not an object, and it would be better if I didn't have to write { Value: 0 }
{
x.Value++;
}
a(x);
alert(x.Value);