JSFiddle - React, Tailwind, and code Playground

by userdude

JavaScript

function replacer(key,value)
{
    if (key=="privateProperty1") return undefined;
    else if (key=="privateProperty2") return undefined;
    else return value;
}

var x = {
    'x':0,
    'y':0,
    'divID':"xyz", 
    'privateProperty1': 'foo',
    'privateProperty2': 'bar'
};

alert(JSON.stringify(x, replacer));