console.log(typeof typeof 1); //string
----------------------------------------
console.log(typeof(NaN)); //number
--------------------------------------
const test = ({ a, b, c }) => {
   console.log(a, b, c);
};
test(0, 1, 2);

//output : undefined undefined undefined
------------------------------------
function test(...args) {
   console.log(typeof args);
}

test(12); //object
--------------------------------------------------
var myObject = {
    name: "Robert",
    test: function() {
        var self = this;
        console.log("outer log 1 "+this.name); //outer log 1 Robert
        console.log("outer log 2 "+self.name); //outer log 2 Robert
        (function() {
            console.log("inner log 1 "+this.name); //undefined
            console.log("inner log 2 "+self.name); //Robert
        }());
    }
};
myObject.test();
------------------------------------------------------
function job() {
    return new Promise(function(resolve, reject) {
        reject();
    });
}
let promise = job();
promise
.then(function() {
    console.log('Success 1');
})
.then(function() {
    console.log('Success 2');
})
.then(function() {
    console.log('Success 3');
})
.catch(function() {
    console.log('Error 1');
})
.then(function() {
    console.log('Success 4');
});
// Error 1
// Success 4 
---------------------------------------------

Leave a Reply

Your email address will not be published. Required fields are marked *