class property not updating value if 'self' keyword is not used
rmccullagh opened this issue · comments
class Buffer
{
function Buffer(value)
{
self.stream = value;
self.position = 0;
}
function advance()
{
return stream[position++];
}
function top()
{
return stream[position];
}
}
buffer = Buffer("Hello World");
buffer.advance();
if(buffer.position == 0)
{
throw "Expected buffer.position to be greater than 0";
}