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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:35:12+00:00 2026-05-20T22:35:12+00:00

I am reading the book JavaScript-The Good Parts, in chapter 4.14 Curry, the book

  • 0

I am reading the book “JavaScript-The Good Parts”, in chapter 4.14 Curry, the book gives the following example:

Function.method('curry', function(){
    var slice = Array.prototype.slice,
        args = slice.apply(arguments), //1st-arguments
        that=this;

    return function(){
       return that.apply(null, args.concat(slice.apply(arguments))); //2nd-arguments
    }
})

var add1=add.curry(1);
document.writeln(add1(6)); // 7

I have two questions on this code:

  1. There are two places using ‘arguments‘. In the method invoking in the last two lines code, is it so that ‘1‘ goes to the 1st-arguments and ‘6‘ goes to the 2nd-arguments?

  2. There is a line of code apply(null, args.concat(slice.apply(arguments))), why does it apply(null,...) here?, what is the sense to apply a argument to a null object?

  • 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-20T22:35:13+00:00Added an answer on May 20, 2026 at 10:35 pm

    There are two places using ‘arguments’. In the method invoking in the last two lines code, is it so that ‘1’ goes to the 1st-arguments and ‘6’ goes to the 2nd-arguments?

    Yes, 1 is part of arguments of the outer function, while 6 goes the arguments in the inner function. The inner function can capture all other variables in a closure except for arguments and this, which have a special meaning inside a function, hence are not part of that closure. So that, and args are captured, but not arguments.

    There is a line of code apply(null, args.concat(slice.apply(arguments))), why does it apply(null,…) here?, what is the sense to apply a argument to a null object?

    Invoking a method with a null context will simply set the this value to the global object. In the case it seems the author does not care what that context is.

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

Sidebar

Related Questions

I am reading the book Javascript: The good parts. Now I am reading chapter
I'm reading the book Javascript: The Good Parts. And I'm confused by the following
While reading a book about JavaScript I stumbled across an example: var names =
I remember reading in Douglas Crockford's Javascript the Good Parts book that there is
I'm reading Douglas Crockford's book JavaScript: The Good Parts. I can't understand the sentence
I am currently reading the book Javascript: The Good Parts and was playing with
Javascript: The Good Parts is a great book. Often I find myself reading passages
I started reading JavaScript: The Good Parts book and became confused at first pages
On Stackers' recommendation, I have been reading Crockford's excellent Javascript: The Good Parts .
I have the following javascript : var MyObject = (function() { function Setup(args) {

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.