Skip to content

Instantly share code, notes, and snippets.

@scriptschat
Created September 24, 2020 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scriptschat/f1eed36d19bf637360318d2458f439cc to your computer and use it in GitHub Desktop.
Save scriptschat/f1eed36d19bf637360318d2458f439cc to your computer and use it in GitHub Desktop.
undefined in JavaScript
var emp = {
name: 'John Snow',
email: 'john.snow@abc.com'
}
console.log(emp.name);
//John Snow
console.log(emp.address);
// undefined (here we are trying to extract a member which object doesn't have)
var test;
console.log(test);
//undefined (a variable defined but not initialized)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment