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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:37:56+00:00 2026-05-12T00:37:56+00:00

I grabbed this code form JCarousel and just trying to understand these lines below.

  • 0

I grabbed this code form JCarousel and just trying to understand these lines below. I’m new to jQuery and not that great at JavaScript so I am not sure what is jQuery and which is JavaScript below

this.buttonNext[n ? 'bind' : 'unbind'](this.options.buttonNextEvent, this.funcNext)[n ? 'removeClass' : 'addClass'](this.className('jcarousel-next-disabled')).attr('disabled', n ? false : true);
this.buttonPrev[p ? 'bind' : 'unbind'](this.options.buttonPrevEvent, this.funcPrev)[p ? 'removeClass' : 'addClass'](this.className('jcarousel-prev-disabled')).attr('disabled', p ? false : true);

It’s setting some of the css to set state and either enabling or disabling the button that is in a but I want to modify this once I really understand it. I just can’t make out exactly what it’s doing 100%.

Trying to understand things such as [n ? ‘bind’ : ‘unbind’] and just the chaining here also. There’s a lot going on in those 4 lines.

The code comes from this plug-in: http://sorgalla.com/projects/jcarousel/

  • 1 1 Answer
  • 1 View
  • 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-12T00:37:56+00:00Added an answer on May 12, 2026 at 12:37 am

    The first part to understand is symbol resolution. Javacript supports both dot-notation and bracket-notation.

    Consider opening a new window.

    window.open()
    

    This is dot-notation in action. you’re telling the interpreter that “open” can be found on “window”. But there’s another way to do this

    window['open']()
    

    Same thing, but with bracket notation. Instead of using the symbol name directly, we’re using a string literal instead. What this means is that by using bracket-notation for symbol resolution, we can do it in a dynamic way, since we can choose or build strings on the fly, which is exactly what this snippet does.

    this.buttonNext[n ? 'bind' : 'unbind'](...);
    

    Is analagous to

    if ( n )
    {
       this.buttonNext.bind(...);
    } else {
       this.buttonNext.unbind(...);
    }
    

    If you don’t recognize the ?: syntax, that’s the conditional operator, or conditional expression

    [expression] ? [valueIfTrue] : [valueIfFalse]
    

    This is extremely often erroneously called the “ternary operator”, when in fact it just a ternary operator (an operator with three operands). The reason for this is because in javascript (and most languages) is the only ternary operator, so that description usually flies.

    Does that help? is there anything else you need cleared up?

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

Sidebar

Ask A Question

Stats

  • Questions 176k
  • Answers 176k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I have done two different things in the past: Use… May 12, 2026 at 3:12 pm
  • Editorial Team
    Editorial Team added an answer You need to raise the number of simultaneous web requests… May 12, 2026 at 3:12 pm
  • Editorial Team
    Editorial Team added an answer MSDN has an article "An In-Depth Look into the Win32… May 12, 2026 at 3:12 pm

Related Questions

I am using asp.net mvc and I am not sure how to approach this
In Flash CS4, open a new document, change the background colour to something recognizeable
I grabbed the following code somewhere off the Internet, and I am using it
I grabbed a database of the zip codes and their langitudes/latitudes, etc from this

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.