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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:06:54+00:00 2026-06-06T02:06:54+00:00

In jquery when I run: $(‘li’).each(some-function(i){}); The IDE seems to know that some-function is

  • 0

In jquery when I run:

$('li').each(some-function(i){});

The IDE seems to know that some-function is expecting an index.

It leads me to believe I can make a function in javascript/jquery that expects a function as one of it’s parameters that expects certain paramters. (I am new to javascript)

I know how to do it in c language.

I am looking for something like this:

void somefuncA ( void (*funcB)(int) ){
    //do stuff with funcB
    (*funcB)(5);
}

So the function ‘somefuncA’ expects to get a function funcB that gets one integer as a parameter and then does something.

Hope that makes sense.. thanks
p.s. I know JavaScript is weakly type but I also noticed that .each() expects a function as parameter and not just any function but one with an int as parameter.

  • 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-06T02:06:56+00:00Added an answer on June 6, 2026 at 2:06 am

    It leads me to believe I can make a function in javascript/jquery that
    expects a function as one of it’s parameters that expects certain
    paramters.

    You may be talking about delegates here. Functions are first-class objects in JavaScript. They don’t define a type-safe pointer like in some other languages. A function can define as many parameters as it likes, but you don’t have to pass even a single one. Skipped parameters will be undefined. They also don’t define any return type. A function may or may not return a value.

    Your IDE is clever enough to find the function call and give you a hint which parameters are provided. You are free to use or skip these parameters in your function.

    $('li').each(function(){
       // do something
    });
    

    Here you create an anonymous function that does not take any parameters. jQuery will pass index or some other parameters inside but it will not produce any errors. You can also create a function that uses the index parameter provided by jQuery.

    $('li').each(function(index){
       // do something
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got away with some jQuery run from the console: $(*).filter(function(){return this.formsField})[0].formsField Search through
Do you know if it's possible to run jQuery on a variable that contains
I am trying to make a button with click function to run my jquery:
On document ready I run this code: jQuery(document).ready(function(){ jQuery('#button').click(function() { jQuery('#contact_form').load(/Users/mge/Downloads/jquery-ajax-1/readme.txt); return false; });
I'm having two jquery's that I run and I want to combine them both
Just wondering if anyone knows of a way that wiring up jquery to run
If a person went to my page I want some jquery to run, then
I'm using jQuery and run various functions that add numeric values to the same
I'm using jQuery to run through all the inputs within a section that I
I have a select box that when clicked on it (and run jQuery code

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.