JSFiddle - React, Tailwind, and code Playground
by Steven Senkus
JavaScript
function isArray(o) {
return Object.prototype.toString.call(o) === '[object Array]';
}
var obj = {
str: 'Bill',
num: 25,
arr: [5, 4, 3, 2, 1],
obj: {
prop: 'prop'
}
};
var objCtr = JSON.stringify(obj);
console.log(objCtr);
console.log(JSON);
delete window.JSON;
try {
console.log(JSON);
} catch (e) {
console.log('error caught', e);
}
if (typeof JSON === 'undefined') {
console.log(window.JSON)
window.JSON = [];
console.log(isArray(window.JSON));
console.log(typeof window.JSON);
JSON.parse = function (str) {
if (str === "") str = '""';
eval("var p=" + str + ";");
return p;
};
}
var x; x = JSON.parse(objCtr);
console.log(x == obj)