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
Peter Retvari
Full Stack JavaScript Techdegree Student 8,392 PointsWhy 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
Kevin Korte
28,149 PointsIs this related to a particular challenge?
Peter Retvari
Full Stack JavaScript Techdegree Student 8,392 PointsPeter Retvari
Full Stack JavaScript Techdegree Student 8,392 PointsI saw toString() in this video: https://teamtreehouse.com/library/getting-the-response-body