Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8230035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:59:58+00:00 2026-06-07T16:59:58+00:00

This is how I do it now. It feels like a hazzle… var broken_posts

  • 0

This is how I do it now. It feels like a hazzle…

var broken_posts = new Object();
broken_posts.empty = new Array();
broken_posts.one = new Array();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T16:59:59+00:00Added an answer on June 7, 2026 at 4:59 pm

    The answers by Andru and Thilo are both correct, but perhaps some information on why is in order:

    • Avoid direct calls to the Array constructor: it’s confusing and misleading. var a = new Array(5); returns [undefined,undefined,undefined,undefined,undefined], whereas var b = new Array('5'); returns ['5']. Or even var c = new Array(5,5); => [5,5].

    • Same applies for the direct object constructor. There’s really no reason to create an object calling the basic object constructor. The only times you should use the keyword new is when creating a date object, or calling a self-made constructor function (and even in that case, there’s no real need for the new keyword, there are alternative design patterns). Using the object literal {} is more common, allows for direct assignment of properties (and even methods). Besides, It’s so much easier to create your objects in a JIT sort of way. Not only does it require less lines of code, with correct use of closures, or just for the one call, an object can get GC’ed once you’re finished with it.


    function iWantAnObject(obj)
    {
        if (obj instanceof Object)
        {
            return true;
        }
        return false;
    }//function returns, obj is GC'ed
    iWantAnObject({just:'some',rand:'Object',withA:function(){console.log('a method';}});
    

    As opposed to this scenario:

    var tempObj = new Object();
    tempObj.just = 'some';//etc...
    //etc...
    iWantAnObjct(tempObj);
    //tempObj isn't yet GC'ed
    

    In the last example chances are: you accidentally create global variables, have various objects in memory that are no longer required, and, last but not least: isn’t very in tune with the prototypal nature of JS.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Website. This feels like a common problem, but it's a difficult one to Google!
This is a stupid question, it feels like one. But mental block is bad
I have 25 UIControls and 10 UIImageView. It looks like this: Now the images
I hate posting this since it's somewhat subjective, but it feels like there's a
It feels like this is a colossally stupid question, but the documentation for rar
I've been trying to fix this problem almost all day (or it feels like
This feels like im missing something obvious, but i've been reading tutorials for 3
I've implemented that default swipe-to-delete gesture in UITableView, and now I feel that this
Edit This question has gone through a few iterations by now, so feel free
This is kind of an academic question, so feel free to exit now. I've

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.