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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:57:17+00:00 2026-06-14T01:57:17+00:00

Example : var myFunctArray=new Array(); for(var i=0; i<10; i++) { addValues(i); } function addValues(myPoint)

  • 0

Example :

var myFunctArray=new Array();

for(var i=0; i<10; i++) {
    addValues(i);
}

function addValues(myPoint)
{
    myFunct=function () {
        var myVar="Line " + myPoint;
        console.log(myVar);
    }    

    myFunctArray.push(myFunct);        
}

myFunctArray[3]();

when I call the 4° function, how can it remembers the value of myPoint? In fact it is Line 3 the output, so myPoint value must be “stored” somewhere, for each function.

So, it stores 10 “definitions” of myFunct in the stack memory?

Hope it is clear what I mean.

  • 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-14T01:57:18+00:00Added an answer on June 14, 2026 at 1:57 am

    It’s called a closure. Any variables that are currently in scope when you create a new function are associated with that closure.

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

Sidebar

Related Questions

Example: var arr_1:Array = new Array(); arr_1.push({sdate:2010-02-02,status:New}); arr_1.push({sdate:2010-02-03,status:New}); arr_1.push({sdate:2010-02-04,status:New}); arr_1.push({sdate:2010-02-05,status:New}); How can i change
Code example: var Events = $({}); Events.on('myCustomEvent', function(){ console.log('myCustomEvent 1') }) Events.trigger('myCustomEvent'); // I
In this simplistic example: var myFunction = function(obj) { console.log($(obj)); } I am using
I have the following array as3 example: var arrayDefinitionsargsAmfPhp:Array = new Array(); arrayDefinitionsargsAmfPhp['tabela'] =
The basic example: var b = 10; var c = b; b++; console.log(b,c); >>
This is my code : var markers={}; example(); function example() { var myFunct =
I have this example: var name; var id; var array = []; $.each(data, function(index,
Im loading multiple SWF of the same file Example: var movies:Array = new Array
For example: var a = []; function p(x) { a.push(x); } [[p(1),p(2)],p(3),[p(4),[p(5)]],p(6)] a ==
Example: var $doesNotYetExistInTheDOM = $('<span/>'); // create new jQuery element // outside of the

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.