Skip to content
← Back to Community
chalk
Profile icon
sandy74

try to run the chalk module in nodejs but some line of code is not run

Voters
Profile icon
niva26
Profile icon
JagrutSharma
Profile icon
parulpathakkk
Profile icon
KirtiSingh5
Profile icon
sandy74
Comments
hotnewtop
Profile icon
Coder100

Hello, that's not valid JSON.
JSON can only store values of type:

  • number
  • string
  • array
  • boolean
  • null
  • object (which can store the above)

So for your JSON, function(){} is invalid and not a type. You will have to change that item:

let str = '{"id": 101, "name":"Srishti", "developer": true}'; let parsedObj = JSON.parse(str); console.log(parsedObj);

Remember JSON is not javascript!

Profile icon
CodeLongAndPros

Moving this to Ask, share is for projects.

Profile icon
InvisibleOne

You should move this to Ask