JSFiddle - React, Tailwind, and code Playground

by vinodlouis

JavaScript

let customStringify = (obj) => {

  return JSON.stringify(obj);
}


let sampleObj = {
  no: 1,
  name: 'Mark',
  present: true,
	/*
  contact: {
    address: '35 street Yoda palace green ville CA',
    cell: {
      office: 287567435,
      personal: 78642639
    }
  }*/
}



let testValid = (obj) => {
  let customResult = customStringify(obj);
  let realResult = JSON.stringify(obj);

  if (customResult === realResult) {
    console.info('Hurray.... Test Passed!');
  } else {
    console.error('Opps..... Test Failed!');
  }
}

testValid(sampleObj);