English 中文(简体)
造物两度会产生不同结果
原标题:Creating an object twice produces different results

我的 j印法如下。 关于 Chrome、 Firefox、 Android、三星星银星(Gingerbread 2.3.3)和Safari,一对一氧化物进行罚款。 在三星银河的本地浏览器上,没有。

该法典规定了物体,并测试物体的数值。 它第一次制造它正确无误的物体。 它第二次制造了标的,这些数值是不正确的。

Java字或V8或装置中的这种ug吗? 你们将如何解决这个问题?

var Padding = function(pleft, ptop, pright, pbottom) {
    this.top = 20;
    this.left = 1;
    this.right = 0;
    this.bottom = 0;
    this.left = pleft;
    this.top = ptop;
    this.right = pright;
    this.bottom = pbottom;
};

function testPadding() {
    var p;
    p = new Padding(91, 92, 93, 94);
    alert(p.left.toString() + "," + p.top.toString() + "," + p.right.toString() + "," + p.bottom.toString());
}

testPadding();  // 91,92,93,94 - correct
testPadding(); // 1,20,93,0 - should be 91,92,93,94
testPadding(); // 1,20,93,0 - should be 91,92,93,94

EDIT:我发现,它为什么在支持者工作。 推器使用不同的 j式发动机。 它使用联合后勤中心而不是V8。 http://code.google.com/p/android/issues/detail?id=12987“rel=“nofollow”http://code.google.com/p/android/issues/detail?id=12987 。 这有助于你开发它使用的发动机。 投稿人使用联合材料,三星银河S使用V8。

问题回答

由于V8发动机如何收集垃圾和进行沥滤,我想象,在开始归还结果之前,该发动机没有这样做。 你们是否试图将你的法典修改到以下? 相反,它是否将预期结果逐年回去?

var Padding = function(pleft, ptop, pright, pbottom) {
    this.top = (ptop != null) ? ptop : 20;
    this.left = (pleft!= null) ? pleft: 1;
    this.right = (pright!= null) ? pright: 0;
    this.bottom = (pbottom!= null) ? pbottom: 0;
};

function testPadding() {
    var p;
    p = new Padding(91, 92, 93, 94);
    alert(p.left.toString() + "," + p.top.toString() + "," + p.right.toString() + "," + p.bottom.toString());
}

testPadding(); // ?
testPadding(); // ?
testPadding(); // ?




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签