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

  • SEARCH
  • Home
  • 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 7743751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:36:55+00:00 2026-06-01T09:36:55+00:00

if(childrens are present) { while(childrens.length ! ==0) { do something } } // Execute

  • 0
if(childrens are present) {

   while(childrens.length ! ==0) {

            do something

    }
}   

// Execute this function fnName()

My problem here is the while condition is getting executed, but when the length becomes zero… it does not come out… and execute the fnName()

  • 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-01T09:36:56+00:00Added an answer on June 1, 2026 at 9:36 am

    If you’re actually removing children from the array in the loop, that should be fine other than that you’ve got the spacing wrong on the operator; it should be !==, not ! ==:

    while(childrens.length !== 0) {
    

    Note that to actually remove children from the array, you have to use one of the array mutator methods, like pop or splice. My guess is that you’re not doing that.

    The more normal thing to do would be to loop through the array without mutating it:

    var index, len, child;
    
    for (index = 0, len = childrens.length; index < len; ++index) {
        child = childrens[index];
        // Use `child` for each child
    }
    

    Or using the new ES5 stuff like forEach (which requires knowing your users will have a very up-to-date browser, or including an “ES5 shim” since forEach is one of the things that can be shimmed):

    childrens.forEach(function(child) {
        // Use `child` for each child
    });
    

    Side note: The word “children” is already a plural (the singular is “child”), so there’s no “s” on the end of it. Just one of English’s irregular plurals (there are several).

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

Sidebar

Related Questions

This database will store a list of children. But the problem is, they will
I have a problem analogous to the one described here: Prevent fork() from copying
I have been working on a function for a while to produce a multidimensional
I require a tree / directed acyclic graph implementation something like this: public class
I have a class that contains hierarchical data. I want to present this data
I've used stackoverflow many a time to solve my problems (code related!) but this
$(this).parent().parent() .children(this.attr(tagName).toLowerCase()) .css(background-color, yellow); xpath: /html/body/div/table/tr/td/b/a $(this).tagName is Anchor <a> the problem with this
Say we're writing a simple recursive function fib(n) that calculates the nth Fibonacci number.
When I programmatically collapse a TreeView node like this: treeView1.Nodes[0].Collapse(), all of the children
Take a look at this site I'm working on: http://appload.nu/flygklubb The first menu-item has

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.