Very well, except that I thought you were also gonna touch upon the let (and/or const) keyword for declaring a variable, thats also if we, in a given interview, mentioned it they would think more highly of ourselves that we know the difference. That is let variable won't let you access it before its initialization. Although hoisted, let is not initialized to a default value (of undefined).
As in your example, it would work similarly if we were to declare let perfectMatch; (gets initialized to undefined) and if we define (initialize) it after the function console.log(), it would still be undefined. But, declaring it after its call -> let throws an ReferenceError and that's why let is more helpful in debugging our code.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Very well, except that I thought you were also gonna touch upon the
let(and/orconst) keyword for declaring a variable, thats also if we, in a given interview, mentioned it they would think more highly of ourselves that we know the difference. That isletvariable won't let you access it before its initialization. Although hoisted,letis not initialized to a default value (ofundefined).As in your example, it would work similarly if we were to declare
let perfectMatch;(gets initialized toundefined) and if we define (initialize) it after the functionconsole.log(), it would still beundefined. But, declaring it after its call ->letthrows anReferenceErrorand that's whyletis more helpful in debugging our code.