English 中文(简体)
我如何在以下的贾瓦特职能中注意到我对关闭案汇编者的“这一”使用?
原标题:How do I annotate my usage of "this" to the Closure Compiler in the following Javascript function?

我正在利用以下职能修改 Java字阵列的具体事例。 我怎么能够说明《关闭汇编》的法典? rel=“nofollow”http://code.google.com/closure/compiler/docs/js-for-compiler.html 通过编辑操作该守则会产生“JSC_USED_GLOBAL_THIS”错误。

function listify(array) {
    array.toString = function() {
        return  [  + this.join( ,  ) +  ] ;
    };
    return array;
};

它不像我那样使用“@extends”或“@ructor annotation”。

我不想修改全球射线原型,因为当其他代码在网页上使用时,这将产生意想不到的副作用。 此外,在阅读。 我认为,我的方法是我的最好办法。 问题只是我不知道如何向诉讼员通报这一问题。

最佳回答
function listify(array) {

    /**
     * Returns the roster widget element.
     * @this {Array}
     * @return {String}
     */
    array.toString = function() {
        return  [  + this.join( ,  ) +  ] ;
    };
    return array;
};
问题回答

暂无回答




相关问题
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.

热门标签