开发者

How do you convert object 'this' to a string?

开发者 https://www.devze.com 2023-01-04 20:45 出处:网络
I am trying to convert a string to an array, while the string is the object this. The function doing this is below:

I am trying to convert a string to an array, while the string is the object this. The function doing this is below:

    function reverseString() { 
        // uses Prototype Javascript开发者_JAVA百科 Framework function 'toArray()'
        return this.toArray().reverse().join('');
    }

Is it possible to convert object this to a string, or is there a different/better way of doing this?


this.toString()


If you are looking to convert to JSON - include json2.js and use JSON.stringify(this)

0

精彩评论

暂无评论...
验证码 换一张
取 消