Skip to main content
1 of 3
Bellash
  • 129
  • 4

What's wrong with this javascript programming approach?

Helllo people I'm now developing an instant messaging system but I'm a little confused : I can't decide which approach do I have to choose!

Here is a code and I want you to tell me what is good/bad with this programming approach: one friend of mine said it's difficult to read, but It works

/*! | (c) 2012, 2013 by Bellashh*/
/// <reference path="jquery-2.0.0-vsdoc.js" />

$(document).ready(function () {
    var ChatProvider = {
        "Friends": [],
        "People": [],
        "Conferences": [],
        "UI": {},
        "Utils": {
        "functions": {
               "alert": function (str) {
               alert(str);
        }/*ChatProvider.Utils.functions.alert*/,

        "addFriend": function (friend) {                    
            ChatProvider.Friends.push(friend);
            alert(ChatProvider.Friends.pop().Names);
        }/*ChatProvider.Utils.functions.addFriend*/,

    }/*ChatProvider.Utils.functions*/,

    "events": {
    }/*ChatProvider.Utils.events*/,

    "settings": {

      }/*ChatProvider.Utils.settings*/
    }
  }//var ChatProvider

ChatProvider.Utils.functions.addFriend({"Names":"bellash"});

});  //$(document).ready

ps: for visibility sake, I added some space between line separating objects' properties

Bellash
  • 129
  • 4