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 6149015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:22:53+00:00 2026-05-23T19:22:53+00:00

var DynamicModelView = { createModelView: function (obj,vitalslength,headerValue) { for(vitalsCount = 0, vitalsLen = vitalslength;

  • 0
var DynamicModelView = {          
    createModelView: function (obj,vitalslength,headerValue) {     
      for(vitalsCount = 0, vitalsLen = vitalslength; vitalsCount < vitalsLen; vitalsCount++) {
              // Business logic... with obj and headerValue

       }       

      I need to call this function again.    
      When i call `this.createModelView(arguements)` it keeps on executing... 
    }            
}

I need execute the function based on the count… the for loop executes perfectly based on the count, but the function executes only once.

  • 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-05-23T19:22:55+00:00Added an answer on May 23, 2026 at 7:22 pm

    There are a couple of ways to handle recursive looping (anyone else remember SICP here? Ah… blessed Scheme).

    createModelView: function (obj,vitalslength,headerValue) {     
      for(vitalsCount = 0, vitalsLen = vitalslength; 
              vitalsCount < vitalsLen; vitalsCount++) {
              // Business logic... with obj and headerValue
    
       }       
    
      // the following will force this method to keep going with the same parameters
      // unless you put a conditional return statement before it
      // I always use an interim variable so JS can't get confused.
      var args = arguments; 
      // are you sure it's this here and not DynamicModelView.createModelView
      this.createModelView.apply(this, args) 
    }
    

    More realistically (and faster), you may want to simply put a while loop inside the function:

    createModelView: function (obj,vitalslength,headerValue) {     
      do {
          for(vitalsCount = 0, vitalsLen = vitalslength; 
                 vitalsCount < vitalsLen; vitalsCount++) {
                 // Business logic... with obj and headerValue
    
           }     
      } while( /* condition which needs to be met to finish loop*/ );  
    }
    

    If you want to make sure that the function only runs x times, then you could do this:

    // notice the last parameter?
    createModelView: function (obj,vitalslength,headerValue, x) {  
      for( var i = 0; i < x; i++ )   
      {
          for(vitalsCount = 0, vitalsLen = vitalslength; 
                 vitalsCount < vitalsLen; vitalsCount++) {
                 // Business logic... with obj and headerValue
    
           }     
      }
    }
    

    Hopefully that can get you started.

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

Sidebar

Related Questions

var plugin = { Init: function() { this.UpdateUI(); if (this.Status() == 1) { ...
var MyObj = function(h,w){ this.height = h; this.width = w; } I would like
var UsersMenu = function(){ this.returnUsers = []; this.retrieve = function(posts){ var temp = [];
var y = new w(); var x = y.z; y.z= function() { doOneThing(); x();
var thumbs = document.getElementsByTagName(img); for (var i=0; i<thumbs.length; i++) { Core.addEventListener(thumbs[i], click, function() {alert(i);});
var results = ['one', 'two', 'one hundred', 'three']; var removal = []; $.each(results, function(i)
var foo = 'hello'; var myfunc = function() { console.log(foo); var foo = foo
var request = new Request({ method: 'get', url: 'onlinestatusoutput.html.php', onComplete:function(response) { $('ajax-content').get('tween', {property: 'opacity',
var valueAsText = $('#counts span').text(); I use this tiny script to parse a span
var AppPatientsList = JSON.parse(JSON RESPONSE); var AppPatientsListSort = AppPatientsList.sort(function(a,b){ return a.firstName.toLowerCase() <b.firstName.toLowerCase() ? -1

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.