From cbe05deb1d84154b4e73d75caf38221285609f57 Mon Sep 17 00:00:00 2001 From: Juribiyan Date: Tue, 3 Oct 2017 18:54:05 +0500 Subject: [PATCH] Fixed errors in "undefined and undeclared" section (#27) --- front-end/interview-questions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/front-end/interview-questions.md b/front-end/interview-questions.md index a4b36c8c..7f2b9fa6 100644 --- a/front-end/interview-questions.md +++ b/front-end/interview-questions.md @@ -675,12 +675,12 @@ console.log(foo == null); // true. Wrong, don't use this to check! function bar() {} var baz = bar(); -console.log(baz === undefined); // undefined +console.log(baz); // undefined ``` A variable that is `null` will have been explicitly assigned to the `null` value. It represents no value and is different from `undefined` in the sense that it has been explicitly assigned. To check for `null,` simply compare using the strict equality operator. Note that like the above, you should not be using the abstract equality operator (`==`) to check, as it will also return `true` if the value is `undefined`. -``` +```js var foo = null; console.log(foo === null); // true