string-tagcloud.js

来自「linux下开源浏览器WebKit的源码,市面上的很多商用浏览器都是移植自Web」· JavaScript 代码 · 共 226 行 · 第 1/5 页

JS
226 行
字号
    Number.prototype.toJSONString = function () {        return isFinite(this) ? String(this) : 'null';    };    Object.prototype.toJSONString = function (w) {        var a = [],     // The array holding the partial texts.            k,          // The current key.            i,          // The loop counter.            v;          // The current value.        if (w) {            for (i = 0; i < w.length; i += 1) {                k = w[i];                if (typeof k === 'string') {                    v = this[k];                    switch (typeof v) {                    case 'object':                        if (v) {                            if (typeof v.toJSONString === 'function') {                                a.push(k.toJSONString() + ':' +                                       v.toJSONString(w));                            }                        } else {                            a.push(k.toJSONString() + ':null');                        }                        break;                    case 'string':                    case 'number':                    case 'boolean':                        a.push(k.toJSONString() + ':' + v.toJSONString());                    }                }            }        } else {            for (k in this) {                if (typeof k === 'string' &&                        Object.prototype.hasOwnProperty.apply(this, [k])) {                    v = this[k];                    switch (typeof v) {                    case 'object':

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?