Bummer! You have been redirected as the page you requested could not be found.

Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Why we're using the toString() method if the data's value is already a string?

Hi folks,

Could you help me why we used toString() method if the data's value is already a string?

// Read the data
  response.on('data', (d) => {

//    add data to the message variable
    body += d;
  });

For me it works without converting the data. I also logged out the data with the typeof method and it says: 'string'

1 Answer

Is this related to a particular challenge?