Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Functions and JQuery need help

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #39133
    Yurda
    Member

    Hi, guys
    Sorry for my bad english…

    Yesterday i was started learning a JQuery at codeacademy. I have some experience with Javascript and JQeury and i thought that iam not a beginner until i was found this exercise.. I realy cant figure out in past 30 minutes what is the correct answer. Please guys youre much more smarter then me and i need your help. Can somebody explaine me step by step what that function doing :) ?


    //this function adds 3 to the number passed in
    function addThree(x) {
    return x + 3;
    }

    //this function takes a function and returns
    //a function that runs the function it was passed,
    //and then runs that function _again_ on the return
    //value of the first call to the function.
    //make sense? look at it until it does.
    function composed(func) {
    return function(x) {
    return func(func(x))
    }
    }

    composed(addThree)(4);
    //what does that return?
    var answer = ;
Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.