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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:56:17+00:00 2026-05-23T14:56:17+00:00

Most obvious example is jQuery where the result of a function is the modified

  • 0

Most obvious example is jQuery where the result of a function is the modified object, to which you can apply same or different functions. An example below is from dan’s blog, but examples are abundant over the internet.

var $inner = $("<div>inner</div>")
// append it to a new outer div
  .appendTo("<div>outer</div>")
// next change the jQuery chain to the "outer" div 
  .parent()
    // append the outer div to the body
    .appendTo("body")
// finally, go back to the last destructive command, 
// giving us back a pointer to the "inner" div
  .end();

Is there literature available on this technique? I’have only seen this being used in an imperative way (if you’d call $inner.append($moreInner) $inner is modified). Would it make sense to use an functional approach with this kind of programming (ie keep the state of the objects unaltered and return a clone of the modified object).

regards,
Jeroen

  • 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-05-23T14:56:18+00:00Added an answer on May 23, 2026 at 2:56 pm

    The technique is generally called Method Chaining. In your example above is forms part of a Fluent Interface

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

Sidebar

Related Questions

Most of time we represent concepts which can never be less than 0. For
The most obvious way to right-align a Label in WinForms doesn't work: setting anchor
I find it curious that the most obvious way to create Date objects in
I really suck at Rails' finders besides the most obvious. I always resort to
Sometimes I break long conditions in if s onto several lines. The most obvious
I need to download several files via http in Python. The most obvious way
I don't think that was the most clear question, but an example should make
I have to related tables like in the example script below: -- Creating table
Perhaps the most obvious way of protecting a company's intellectual property from its own
It seems like every unit test example I've encountered is incredibly obvious and canned.

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.