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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:40:10+00:00 2026-06-03T05:40:10+00:00

I remember coming across the solution for this problem.. There is a special term

  • 0

I remember coming across the solution for this problem.. There is a special term for this type of argument if I am not wrong.. But I just can’t remember exactly what it is. I try searching for it on the web but to no avail.. So here it comes:

I want to pass an argument that consists of a function. What should I do?

function meow(cat){
    var z = $("#nyan").position().cat;
    alert(z);
}

meow(left);

or

function meow(cat){
    var z = $("#nyan").cat();
    alert(z);
}

meow(height);
  • 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-03T05:40:11+00:00Added an answer on June 3, 2026 at 5:40 am

    That’s not quite a function; it looks more like you want a name of a property.

    I’m just going to throw a few suggestions at you and see which one you like the most.

    function meow(cat) {
        var z = $("#nyan").position()[cat];
        alert(z);
    }
    
    meow("left");
    

    … or …

    function meow(cat) {
        var z = $("#nyan")[cat]();
        alert(z);
    }
    
    meow("height");
    

    … or, really using a function:

    function meow(getter) {
        var z = getter($("#nyan"));
        alert(z);
    }
    
    meow(function(nyan) { return nyan.position().left });
    meow(function(nyan) { return nyan.position().top });
    // etc.
    

    Edit: the most important thing is that a.b is equivalent to a["b"]—note the quotes in the latter.

    So if you want a.x if width is true or a.y if width is false, for example:

    var result = a[width ? "x" : "y"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I remember coming across a website where I could type in some code and
I remember coming across a very minimalistic PHP CMS that targets mainly artists as
I remember coming across an article on I think CodeProject quite some time ago
I know this is a low-level question but, not being a database person, I
I remember doing this years ago, but can't remember if it was with SWFObject
I remember with ASMX there was an easy solution: MyAsmxServiceClient serviceClient = new MyAsmxServiceClient(http://myServiceLocation/myService.asmx);
I'm pretty sure I remember reading --but cannot find back the links anymore-- about
Note: I'm using Zend Framework, but I think most of this applies to PHP
I remember coming reading about a python module/lib that helped make nice command line
Coming from WinForms/WPF I've learned the hard way that not remembering to unhook event

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.