[HN Gopher] An Open Source Book That Teaches JavaScript
       ___________________________________________________________________
        
       An Open Source Book That Teaches JavaScript
        
       Author : iamsuman
       Score  : 129 points
       Date   : 2023-04-11 12:45 UTC (10 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | azangru wrote:
       | Does anyone else get frustrated when they see, in blogs,
       | articles, or books, introductions such as this:
       | 
       | > Computers are common in today's world, as they are able to
       | perform a wide variety of tasks quickly and accurately. They are
       | used in many different industries, such as business, healthcare,
       | education, and entertainment, and have become an essential part
       | of daily life for many people. Besides this, they are also used
       | to perform complex scientific and mathematical calculations, to
       | store and process large amounts of data, and to communicate with
       | people around the world.
       | 
       | Anyone who would open this book must already know all this. Is
       | there anyone who does not know that computers are everywhere?
       | Does any prospective reader of a book on programming feel that
       | computers are not essential? Does anyone doubt that complex
       | scientific and mathematical calculations are made on computers?
       | Who is this paragraph for? Who has taught us not to proceed
       | straight to business?
        
       | chrizel wrote:
       | Another excellent and also OpenSource book, which I used a couple
       | of years ago to refresh my knowledge about modern JavaScript is
       | Eloquent JavaScript by Marijn Haverbeke. Highly recommended.
       | https://eloquentjavascript.net/
        
         | bouvin wrote:
         | I came here to recommend the very same. The interactive code
         | examples are also very good for students.
        
       | pmoriarty wrote:
       | Has anyone here successfully learned any programming languages
       | with the help of ChatGPT?
       | 
       | I feel like we might be entering a new era of education with
       | these LLMs, who will patiently tutor you and answer your every
       | question (not perfectly yet, but we're getting there).
        
       | dontchooseanick wrote:
       | Commenting on the last exercise, "loops" on
       | https://javascript.sumankunwar.com.np/
       | 
       | The average functional programmer writes this - and not a for
       | loop :                   ````         const fizzbuzz =
       | (n)=>(n%15==0)?"FizzBuzz":(n%5==0)?"Buzz":(n%3==0)?"Fizz":n;
       | Array(101).fill(0).map((_,i)=>fizzbuzz(i))          ````
        
         | simonw wrote:
         | That's covered in a later chapter:
         | https://javascript.sumankunwar.com.np/arrays/map.html
        
         | LordDragonfang wrote:
         | Array(101).fill(0).map((_,i)=> [...])
         | 
         | It's astonishing to me that even with all the niceties added to
         | ES7+, JS still needs to resort to a hack like this for a simple
         | range generator. At least give iterators support for forEach(),
         | reduce(), and map(), so we can use `Array(100).keys()` without
         | having to wrap it with the spread operator.
         | 
         | Also, can't help but snark that apparently the "average" FP is
         | so preoccupied with showing off their one-liners that they fail
         | the problem requirements (should be `Array(100).fill(0).forEach
         | ((_,i)=>console.log(fizzbuzz(i+1)))`).
        
           | graftak wrote:
           | A little bit better: Array.from({ length: 100 }, () => ...)
        
         | metalliqaz wrote:
         | I don't think that was the intention of the exercise.
        
       | zhte415 wrote:
       | Super.
       | 
       | A book offers structure to get going. 'By example' is great too.
       | As is 'read the manual'. [Good to have all, I like books.]
       | 
       | Getting a structure filled out takes a fair bit of effort. That
       | hurdle's overcome. On Github, its easy to fork / contribute - the
       | tools are right there along with a creative commons (or, Apache
       | in this case) license.
       | 
       | Structure, content, license and tools are all there.
        
       ___________________________________________________________________
       (page generated 2023-04-11 23:01 UTC)