Thanks for pointing this out and you are both right, by default it should output hello undefined but here I run the code in a strict mode which was my mistake I forgot to mention it(now edited and corrected ). So running this in strict mode it will throw an exception and output with TypeError :)
Thanks for good article!
Can you explain more why this
code returns exception?
Just context of the
printName
function refers towindow
object, as I understand, and because of this output should behelloundefined
?Hello guys
Thanks for pointing this out and you are both right, by default it should output hello undefined but here I run the code in a strict mode which was my mistake I forgot to mention it(now edited and corrected ). So running this in strict mode it will throw an exception and output with TypeError :)
BTW, it would work