Skip to content

Instantly share code, notes, and snippets.

View kingstenbanh's full-sized avatar

Kingsten Banh kingstenbanh

View GitHub Profile
typeof null // object (bug in the language)
typeof null // object (bug in the language)
var array = ['a', 'b', 'c', 'd', 'e'];
delete array[2];
console.log(array[2]); // undefined
var meals = function (breakfast, lunch, dinner, midnightSnack) {
console.log('Breakfast is ' + breakfast);
console.log('Lunch is ' + lunch);
console.log('Dinner is ' + dinner);
console.log('Midnight snack is ' + midnightSnack);
}
meals('Pancakes', 'Burritos', 'Pork Chop');
// Breakfast is pancakes
// Lunch is burritos
var noReturn = (function() { })(); // undefined
var returnNoValue = (function( { return; })(); // undefined
var returnOne = (function( { return 1; })(); // 1
var mySkills = ['JavaScript', 'jQuery'];
var JavaScript = skills[0]; // 'JavaScript'
var jQuery = skills[1]; // 'jQuery'
var fly = skills[2]; // undefined
unDeclared; // Reference Error: unDeclared is not defined var noValueDefined; // undefined
window.hasOwnProperty(undefined); // true
typeof undefined // undefined
android