Jump to content
Larry Ullman's Book Forums

masonbarge

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by masonbarge

  1. I'm in Chapter 7 pp 250-253 (words.js) and don't get something.

     

    The heart of the js is the line in where the map and sort methods are chained in the sortWords(max) function definition.

     

    var sorted = words.map (function(value) {return value.toLowerCase();}).sort();
    

     

    What I don't understand is how or why the parameter "value" in the anonymous function gets its argument. Obviously it receives the value of each item in the array but I can't figure out why.

     

    While I'm at it, I can't understand why sortWords(max) has the parameter "max". Is this just a feature that wasn't used but got left in?

×
×
  • Create New...