📜  javascript stringify 换行符 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:54.959000             🧑  作者: Mango

代码示例1
const data = {  
  name: 'foo',
  date: new Date(),
  data: [
    {
      question: 'What is the meaning of '+typeof(any),
      answer: 42
    }
  ]
}

console.log(  
  JSON.stringify(data, null, 2)    // null - no formatter, 2 - spaces per indentation
)