Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Message from discussion Need some JavaScript puzzles
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Conrad Lender  
View profile  
 More options Sep 26 2008, 10:07 pm
Newsgroups: comp.lang.javascript
From: Conrad Lender <crlen...@yahoo.com>
Date: Sat, 27 Sep 2008 04:07:16 +0200
Local: Fri, Sep 26 2008 10:07 pm
Subject: Re: Need some JavaScript puzzles
On 2008-09-27 03:18, Jorge wrote:

>> Define function add such that>
>>      add(3)(4)
>> returns 7.

> javascript:alert((function add (p) { var a=p; return function (p)
> { return a+p } })(3)(4))

You don't need to create an extra variable.

function add (first) {
    return function (second) {
        return first + second;
    }

}

But hey!
Don't spoil the fun for the OP by posting the solution!

@Douglas:
I'd also appreciate more puzzles if you know any. This kind of (simple
but interesting) problem is a godsend when you're teaching kids.

The only thing I've seen recently that comes close to a puzzle is this
website:

  http://parentnode.org/static/challange2.html

You need to enter the correct password, that's all. No rewards :-) It's
not pretty, rather the opposite, but if you like obfuscation, it might
be interesting. Syntax highlighting helps.

  - Conrad


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.