Forums

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

Home Forums JavaScript Help with one function

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #149517
    Kuzyo
    Participant

    Here I have one simple function, here what id should do:

    • every time when I call function and pass the argument it should be added to array, if I didn’t pass argument function shoud show array with before passed arguments

    here what I have :

    function makeBuffer() {
      return function( value ) {
        var result = [];
        result.push( value );
        return result;
      }
    }
    
    var buffer = makeBuffer();
    console.log( buffer('start') );
    console.log( buffer('learn') );
    console.log( buffer(' JavaScript') );
    

    Can somebody help. Thanks

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.