I think this is a beginner JavaScript question. Here's a piece of code (taken from Discover Meteor) to illustrate:
Meteor.methods({
    // why function is necessary here?
    post: function(postAttributes) {
        var user = Meteor.user(),
            // why is not necessary here?
            postWithSameLink = Posts.findOne({
                url: postAttributes.url
            });
        // ensure the user is logged in
        if (!user)
            throw new Meteor.Error(401, "You need to login to post new stories");
        // ensure the post has a title
        if (!postAttributes.title)
            throw new Meteor.Error(422, 'Please fill in a headline');
        // check that there are no previous posts with the same link
        if (postAttributes.url && postWithSameLink) {
            throw new Meteor.Error(302,
                'This link has already been posted', postWithSameLink._id);
        }
        // pick out the whitelisted keys
        // and why not below here?
        var post = _.extend(_.pick(postAttributes, 'url', 'title', 'message'), {
            userId: user._id,
            author: user.username,
            submitted: new Date().getTime()
        });
        var postId = Posts.insert(post);
        return postId;
    }
});
I believe there is a simple explanation for this. How do I solve this confusion?
 
     
     
     
    