In your code:
> function setName(obj) {
The value of the first argument in the call is assigned to local variable obj. If an object is passed, the value of obj is a reference to that object.
> obj.name = "raziq";
This will assign the value "raziq" to the name property of the object passed to obj. If the name property doesn't exist, it's created.
> obj = new Object();
This assigns a new object reference as the value of obj, so it no longer references the object passed to the function.
> obj.name = "abdul";
This assigns the value "abdul" to the name property (creating the property if it doesn't exist) of the object referenced by obj (the new one created and assigned in the line above).
Since there is no other reference to this object, it is made available for garbage collection as soon as the function ends.
> }
>
> var person = new Object();
Creates a new object and assigns it to the variable person. The value of person is a reference to the new object.
> setName(person);
Calls setName and passes it the object created on the line above. The function assigns raziq to the name property of the object (see above).
> alert(person.name); //still yields raziq
Alerts the value of the name property of the object created above and assigned to person. Since raziq was assigned as the value, that's what is returned.
Note that a new object is created in the function and a name property is created in an assignment statement, but the object isn't assigned anywhere or return it from the function, so everything after:
obj = new Object();
effectively does nothing.
Note that it is more common to write:
obj = {};
which has exactly the same result as the previous line, but is less to type and more widely used so likely (marginally) easier to read and maintain.