first you are using function as argument so it should be
var fnName = function(){return 'john'};
and also you should also know the execution pattern of javascript that is person.fname will be undefined so insted of defining the function below your object define at the top and do not invoke function instantly after defining that function because you need to get the value not fnname not to invoke there only.
also the object should also not to be defined like that you have defined if you do so then it will throw an exception so to define an object it format is
var objectname = {
propertyname : propertyvalue,
propertyname : propertyvalue,
propertyname : {
anotherpropertname : anotherpropertyvalue,
anotherpropertname : anotherpropertyvalue
}
};
remember when you are on the last property then dont use comma as you can see in the above example. object can also have a value as a function.
in your first property of your object person
insted of define a function fnName seprately you could also written as
var person = {
firstname : function(){return 'john'}
};
another intresting thing is that window is also an object that is you can also define an object like this window["person"] ={fanme:FnName, age:50}
and so on..