Jeetu Alex - IT Software Professional specialized in developing high-end, customized business solutions using Coldfusion and Java.

Coldfusion
Java
JQuery

An online resource for latest web technologies like Coldfusion, JRun, Pro*C, JQuery, HTML5, PHP, W3C, Java, J2EE, C, C++, ORACLE, PL/SQL, MySql, Ajax, Coldbox, Fusebox, UNIX, JavaScript, NodeJS and much more...

Saturday, June 18, 2016

JavaScript: Understanding the Weird Parts



Examples:

var p = {name: 'a', getName: function(){ return this.name;}}

function greet(p) {
    console.log(p.lastname);
}

console.log(p.getName());
greet(p);
greet({lastname:'mary'});



/*var a;

//a = 0;

if(a || a === 0) {
        console.log(a);
}*/


/*var b;
if((b = 2) * 2 === 4) {
    console.log(b);
}*/



/*function wait3mins() {
    var date = new Date().getTime() + 30000;
    while(new Date() < date) {
        
    }
    console.log("finished");
}

function clickHandler() {
    console.log("clicked");
}

document.addEventListener("click", clickHandler);

wait3mins();
console.log("final finished");*/




/*function a() {
    
    function b() {
        //var i;
        console.log(i);
    }
    
    var i = 10;
    console.log(i);
    b();
}

var i = 20;
console.log(i);
a();*/


/*function b() {
    //var i;
    console.log(i);
}

function a() {
    var i = 10;
    console.log(i);
    b();
}

var i = 20;
console.log(i);
a();*/

/*
var a = "hello";
function b() {
    
    console.log('hello jeetu');
    
}

b();
console.log(a);
*/

/*var a;

if (a === undefined) {
     console.log(a);
} else {
    console.log("defined");
}*/

2 comments :

Karthika Shree said...

It's interesting that many of the bloggers to helped clarify a few things for me as well as giving.Most of ideas can be nice content.The people to give them a good shake to get your point and across the command.
Java Training in Chennai

Praylin S said...

Very informative post! I got a lot of idea and information after reading your article. Thanks for your great effort. Keep posting and keep us updated.
Manual Testing Training in Chennai | Manual Testing Courses in Chennai | Manual Testing Training | Manual Testing Training Institute in Chennai | Manual Testing Course | Manual Testing Course in Chennai | Manual Testing Training Chennai

Post a Comment