var a = "a";
var a = "a1";
Login in to like
Login in to comment
2018 Feb 4, 5:42:40 PM
I forgot that functions also hoisted, that's why second log will clouser the undefined value of a.
2018 Jan 23, 2:13:34 PM
@irina8petrova49 Thanks! Fixed)
2017 May 17, 11:48:05 PM
undefined undefined a1 - it's right answer without 'use strict'
with 'use strict' - Uncaught SyntaxError: Unexpected identifier and stopping the script execution
2017 Apr 2, 10:33:32 AM
Isnt var a already global when the first console.log gets executed ?
How is it undefined ?
2016 Nov 29, 5:35:05 PM