????JavaScript δ??????????????????????var name is not defined???????д????????????????????
????????????typeof undeclared_variable????????????????????? undefined??
????var x; // ???? x
????console.log(x); //output: undefined
????console.log(typeof y); //output: undefined
????console.log(z); // ?????: ReferenceError: z is not defined

????????2:???????????????
????var y = 1;
????if (function f(){}) {
????y += typeof f;
????}
????console.log(y);
??????????????? 1undefined??
????JavaScript??if????????????eval??????eval(function f(){}) ???? function f(){} ??? true??
???????????????????????£???????Ч????
????var k = 1;
????if (1) {
????eval(function foo(){});
????k += typeof foo;
????}
????console.log(k);
???????????????????? 1undefined??????????????? eval() ?????????????
?????÷??????????????????????????? string ?????????????????????÷??????????κθ???????
?????? function f(){} ?????????? undefined????????ж??????
??????????????????′??????
????var k = 1;
????if (1) {
????function foo(){};
????k += typeof foo;
????}
????console.log(k); // output 1function

????????3:??JavaScript?д????????????private???????????
???????????????????private??????????????????????
??????????????
var Employee = function (name?? company?? salary) {
this.name = name || "";
this.company = company || "";
this.salary = salary || 5000;
// Private method
var increaseSalary = function () {
this.salary = this.salary + 1000;
};
// Public method
this.dispalyIncreasedSalary = function() {
increaseSlary();
console.log(this.salary);
};
};
// Create Employee class object
var emp1 = new Employee("John"??"Pluto"??3000);
// Create Employee class object
var emp2 = new Employee("Merry"??"Pluto"??2000);
// Create Employee class object
var emp3 = new Employee("Ren"??"Pluto"??2500);
?????????? emp1??emp2??emp3???????increaseSalary??з??????????
????????????????????????????????з?????

????????4:JavaScript??????????д?????????
???????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????
???????????????????
????????????????????
?????????????????
var globalVar = "abc";
// Parent self invoking function
(function outerFunction (outerArg) { // begin of scope outerFunction
// Variable declared in outerFunction function scope
var outerFuncVar = 'x';
// Closure self-invoking function
(function innerFunction (innerArg) { // begin of scope innerFunction
// variable declared in innerFunction function scope
var innerFuncVar = "y";
console.log(
"outerArg = " + outerArg + " " +
"outerFuncVar = " + outerFuncVar + " " +
"innerArg = " + innerArg + " " +
"innerFuncVar = " + innerFuncVar + " " +
"globalVar = " + globalVar);
}// end of scope innerFunction)(5); // Pass 5 as parameter
}// end of scope outerFunction )(7); // Pass 7 as parameter
innerFunction is closure that is defined inside outerFunc
????????????
????outerArg = 7
????outerFuncVar = x
????innerArg = 5
????innerFuncVar = y
????globalVar = abc

????????5:д???mul????????÷????????
????console.log(mul(2)(3)(4)); // output : 24
????console.log(mul(4)(3)(4)); // output : 48
??????????????
????function mul (x) {
????return function (y) { // anonymous function
????return function (z) { // anonymous function
????return x * y * z;
????};
????};
????}
??????????£? mul ?????????????????????????????????????????????????????????????????????? x??y??z ????????????????ɡ?
????????JavaScript?е?????????????????????
????????????????
???????????????????????????????????????
?????????????????????????????????
???????????????????????????????
???????????????????????

????????6:JavaScript????????????
??????
????var arrayList = ['a'??'b'??'c'??'d'??'e'??'f'];
?????????? arrayList
????????1
????arrayList = [];
?????????arrayList???????????????????
????????2
????arrayList.length = 0;
??????????????????length=0 ??????????????
????????3
????arrayList.splice(0?? arrayList.length);
?????????2????

????????7:????ж????object?????????(array)??
????????1
??????? Object.prototype.toString ???ж??????????
????function isArray(obj){
????return Object.prototype.toString.call( obj ) === '[object Array]';
????}
???????????call??? toString ?? this ??? obj??????????ж?
??????????
??????? ????? ??????ж?
????function isArray(obj){
????return obj.__proto__ === Array.prototype;
????}
????????????????? ????????????????????????????? ???? __proto__??????????? prototype?????
????????3
????????JQuery
????function isArray(obj){
????return $.isArray(obj)
????}
????JQuery isArray ?????????????1

????????8:??????????????
????var output = (function(x){
????delete x;
????return x;
????})(0);
????console.log(output);
????????? 0?? delete ?????????object???????????????????????? x ????????????????delete ???????????????á?

????????9:??????????????
????var x = 1;
????var output = (function(){
????delete x;
????return x;
????})();
????console.log(output);
????????? 1??delete ?????????object???????????????????????? x ????????????????delete ???????????????á?

????????10:??????????????
????var x = { foo : 1};
????var output = (function(){
????delete x.foo;
????return x.foo;
????})();
????console.log(output);
????????? undefined??x????????????????????????object??delete??????x.foo?????????x.foo???????????undefined

????????11:??????????????
????var Employee = {
????company: 'xyz'
????}
????var emp1 = Object.create(Employee);
????delete emp1.company
????console.log(emp1.company);
????????? xyz??????? emp1 ??? prototype ????? Employee?? company??emp1????????company?????????delete????????????????Ч???

????????12:???? undefined x 1 ??
??????chrome????????′?????????????undefined x 1???????
????var trees = ["redwood"??"bay"??"cedar"??"oak"??"maple"];
????delete trees[3];
????console.log(trees);
????????????? delete ?????????????????е????????????λ?????????λ?????????????undefined x 1??
?????????????????trees[3] === 'undefined × 1'??????? false?????????????????????????????????undefined x 1??

????????13:??????????????
????var trees = ["xyz"??"xxxx"??"test"??"ryan"??"apple"];
????delete trees[3];
????console.log(trees.length);
?????????5?????delete????????????????????????