[nodejs] What's the default value of a buffer

2012-12-07 Thread Goddy Zhao
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/joy

Re: [nodejs] What's the default value of a buffer

2012-12-07 Thread Dan Milon
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], any