n-riesco / ijavascript

IJavascript is a javascript kernel for the Jupyter notebook
Other
2.18k stars 187 forks source link

var and let keywords drops result #46

Closed slavaGanzin closed 8 years ago

slavaGanzin commented 8 years ago

@n-riesco Help me please to eliminate this bug. When I declare global variable and assigns something to it, I have nice formatted result, but if I prepend this statement with 'var' keyword I got 'undefined'.

nriesco

I didnt try this in notebook or ipython console, but I think it should fail too.

n-riesco commented 8 years ago

On 21/10/15 14:42, Slava wrote:

@n-riesco https://github.com/n-riesco Help me please to eliminate this bug. When I declare global variable and assigns something to it, I have nice formatted result, but if I prepend this statement with 'var' keyword I got 'undefined'.

nriesco https://cloud.githubusercontent.com/assets/1011721/10638179/41c059c4-7812-11e5-99aa-713611abd2c5.png

I didnt try this in notebook or ipython console, but I think it should fail too.

This behaviour is defined by the ECMA standard.

For more background, see the following question on stackoverflow:

http://stackoverflow.com/questions/3957284/variablestatement-semantics-in-ecmascript