Its just allocated space, there's no default. It defaults to whatever the previous process which owned that chunk of memory wrote there.
danmilon. On 12/08/2012 04:14 AM, Goddy Zhao wrote: > var buf = new Buffer(1); console.log(buf[0]); > > The above code will print a random value of buf[0], anyone know why > the default value of a buffer element is not 0 but a random one, > and what's the rule of the value? > > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > > You received this message because you are subscribed to the Google > Groups "nodejs" group. To post to this group, send email to > nodejs@googlegroups.com To unsubscribe from this group, send email > to nodejs+unsubscr...@googlegroups.com For more options, visit this > group at http://groups.google.com/group/nodejs?hl=en?hl=en -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en