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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:26:53+00:00 2026-06-09T02:26:53+00:00

I noticed that I’ve been using both in my code – interchangeably and randomly.

  • 0

I noticed that I’ve been using both in my code – interchangeably and randomly. Particularly, when I have a call back and I need a value to persist when the function is “called back”. Does it matter whether you use passed parameters or static parameters? By static I mean function object properties. I’m using the term loosely. Here is the example I’m working on.

    message_object.display( type );
    document.getElementById( 'po_but_cov' ).style.display='inline';
    pos = 30;
    MC.MATweet.movePane.dir = 'down';
    MC.MATweet.movePane( pane_element, pos );

    return o_p;
},
movePane: function( pane_element, pos ) {
    if( ( MC.MATweet.movePane.dir === 'down' ) && ( pos < 70 ) ) {
        pos += 1;
        pane_element.style.top = ( pos ) + 'px';
        setTimeout( function( ){ MC.MATweet.movePane( pane_element, pos ); }, 1 );
    }
    else if( ( MC.MATweet.movePane.dir === 'down' ) && pos === 70 ) { 
        MC.MATweet.movePane.dir = 'up';
        setTimeout( function( ){ MC.MATweet.movePane( pane_element, pos ); }, 2000 );
    }
    else if( ( MC.MATweet.movePane.dir === 'up' ) && ( pos > 30 ) ) {
        pos -= 1;
        pane_element.style.top = ( pos ) + 'px';
        setTimeout( function( ){ MC.MATweet.movePane( pane_element, pos ); }, 1 );
    }
    else if( ( MC.MATweet.movePane.dir === 'up' ) && ( pos === 30 ) ) {
        document.getElementById( 'po_but_cov' ).style.display='none';
    }
},

As you can see I use pos as a passed parameter and I use MC.MATweet.movePane.dir as a static parameter. I need both available when the function is called back after set amount of time.

I’d like to make the style of my code more consistent. For some reason, the value that changes more, pos, I passed as a parameter, and the value that changes only once MC.MATweet.movePane.dir I used as a static variable. Don’t think this is relevant, just reflecting.

How can I be more consistent? Does it matter which one you choose?

FYI, this code just animates a box, moving it down, pausing, and moving it back up.

  • 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-09T02:26:54+00:00Added an answer on June 9, 2026 at 2:26 am

    Went ahead with straight parameters for now so I could move initialization into the initial function call.

    Resulting code:

        message_object.display( type );
        document.getElementById( 'po_but_cov' ).style.display='inline';
        MC.MATweet.movePane( pane_element, 30, 'down' );
    
        return o_p;
    },
    movePane: function( pane_element, pos, dir ) {
        if( ( dir === 'down' ) && ( pos < 70 ) ) {
            pos += 1;
            pane_element.style.top = ( pos ) + 'px';
            setTimeout( function( ){ MC.MATweet.movePane( pane_element, pos, dir ); }, 1 );
        }
        else if( ( dir === 'down' ) && pos === 70 ) { 
            dir = 'up';
            setTimeout( function( ){ MC.MATweet.movePane( pane_element, pos, dir ); }, 2000 );
        }
        else if( ( dir === 'up' ) && ( pos > 30 ) ) {
            pos -= 1;
            pane_element.style.top = ( pos ) + 'px';
            setTimeout( function( ){ MC.MATweet.movePane( pane_element, pos, dir ); }, 1 );
        }
        else if( ( dir === 'up' ) && ( pos === 30 ) ) {
            document.getElementById( 'po_but_cov' ).style.display='none';
        }
    },
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I noticed that I have a lot of repeated code in my divs and
I noticed that code after return from ExecuteRegisteredAsyncTasks call is executed in same thread
I noticed that after I quit an app using the back button, when I
I noticed that in the i18n rails guide, they have the following code: en:
I noticed that a lot of tutorial instructions often have this code: $sql=SELECT *
I noticed that the <td align=center> code works differently on the MediaWiki.org page and
Ive noticed that MVC 2 uses masterpages and ascx pages. I'm used to using
I noticed that the following code: <Button Content=_Timbres... Command={Binding Path=ShowTimbresCommand} IsEnabled={Binding Path=CanExecuteShowTimbresCommand}/> behaves equally
I noticed that most (all?) .winmd files have a version of 255.255.255.255 like: Windows,
I noticed that itertools does not (it seems to me) have a function capable

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.