title: Javascript nodejs JSON.parse array
body: <p>I'm taking a course on udemy and i'm really confused on how <code>notes = JSON.parse(notesString)</code> is an array when it's suppose to be an object (right?) since JSON.parse makes it an object.</p>
  
  <pre><code>var addNote = (title, body) =&gt; {
    var notes = []; // Create empty array
    var note = { // Fetch user input
      title,
      body
    };
    try {
      var notesString = fs.readFileSync("notes-data.json"); //  Get current notes
      notes = JSON.parse(notesString); // convert current notes into object
      console.log("try:", notes.constructor)
    }catch(e){
  
    }
    console.log(notes)
    notes.push(note);
    fs.writeFileSync("notes-data.json", JSON.stringify(notes));
  };
  </code></pre>