Skip to content
This repository has been archived by the owner on Mar 29, 2020. It is now read-only.

My solutions to the Programming Assignment Questions given at the end of chapters of the book, "Eloquent JavaScript 3rd Edition" by Marijn Haverbeke (https://eloquentjavascript.net/). [Completed]

Notifications You must be signed in to change notification settings

SuyashD95/eloquent-js-solutions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eloquent-javascript-solutions

My solutions to the Programming Assignment Questions given at the end of chapters of the book, "Eloquent JavaScript 3rd Edition" by Marijn Haverbeke (https://eloquentjavascript.net/).

Table of Contents

Part 1: Language


  1. Values, Types & Operators

    No Programming Exercises are available for this chapter.

  2. Program Structure

    1. Looping A Triangle (Jump to Solution)

    2. FizzBuzz (Jump to Solution)

    3. Chessboard (Jump to Solution)

  3. Functions

    1. Minimum (Jump to Solution)

    2. Recursion (Jump to Solution)

    3. Bean Counting (Jump to Solution)

  4. Data Structures: Objects and Arrays

    1. The Sum Of A Range (Jump to Solution)

    2. Reversing An Array (Jump to Solution)

    3. A List (Jump to Solution) (Recommended)

    4. Deep Comparison (Jump to Solution) (Recommended)

  5. Higher-Order Functions

    1. Flattening (Jump to Solution)

    2. Your Own Loop (Jump to Solution)

    3. Everything (Jump to Solution) (Recommended)

    4. Dominant Writing Direction (Jump to Solution) (Recommended)

  6. A Secret Life of Objects

    1. A Vector Type (Jump to Solution) (Recommended)

    2. Groups (Jump to Solution) (Recommended)

    3. Iterable Groups (Jump to Solution) (Recommended)

    4. Borrowing A Method (Jump to Solution) (Recommended)

  7. Project: A Robot

  8. Bugs and Errors

    1. Retry (Jump to Solution) (Recommended)

    2. The Locked Box (Jump to Solution) (Recommended)

  9. Regular Expressions

    1. Regexp Golf (Jump to Solution)

    2. Quoting Style (Jump to Solution) (Recommended)

    3. Numbers Again (Jump to Solution) (Recommended)

  10. Modules

    • It is recommended to revisit this chapter after finishing up the section on Node (Part 3 of Eloquent JS) as it will further improve the understanding of the reader on topics like CommonJS modules and dependencies.

    • I have decided not to provide answers of the 1st & 3rd programming exercises due to the theoretical, opinion based nature of the questions.

      You are more than welcome to attempt these questions and (if you want) look at possible solutions on the official site.

    • NOTE: The solution to the 2nd programming exercise (while correct) will only work on your if both NodeJS & graph module/package are installed on your system.

    • Programming Exercises

      1. A Modular Robot (Solution NOT PROVIDED)

      2. Roads Module (Jump to Solution)

      3. Circular Dependencies (Solution NOT PROVIDED)

  11. Asynchronous Programming

  12. Project: A Programming Language

    • It is highly recommended to read a line-by-line analysis of the key sections of project's code to develop a better understanding of the approach undertaken by the author and can immensely help in solving the programming exercises.

      Deep Dive into the code of Chapter 12's Project

    • I have decided not to provide answer to the 2nd programming exercise due to its theoretical, opinion based nature.

      You are more than welcome to attempt these questions and (if you want) look at possible solutions on the official site.

    • Programming Exercises

      1. Arrays (Jump to Solution) (Recommended)

      2. Closure (Solution NOT PROVIDED)

      3. Comments (Jump to Solution) (Recommended)

      4. Fixing Scope (Jump to Solution) (Recommended)

Part 2: Browser


  1. JavaScript and the Browser

    No Programming Exercises are available for this chapter.

  2. The Document Object Model

    1. Build A Table (Jump to Solution) (Recommended)

    2. Elements By Tag Name (Jump to Solution) (Recommended)

    3. The Cat's Hat (Jump to Solution) (Recommended)

  3. Handling Events

    1. Balloon (Jump to Solution) (Recommended)

    2. Mouse Trail (Jump to Solution) (Recommended)

    3. Tabs (Jump to Solution) (Recommended)

  4. Project: A Platform Game

  5. Drawing on Canvas

    • I have decided not to provide answer to the 4th programming exercise due to its theoretical, opinion based nature.

      You are more than welcome to attempt these questions and (if you want) look at possible solutions on the official site.

    • DISCLAIMER: I found this chapter's exercises to be the most challenging ones yet... In fact, I was unable to find a perfect solution to any of the given exercises...

      I was only able to get them partially right, but was unsuccessful in writing a solution that met all of the given requirements, of a particular question.

      Initially, I wanted to upload my imperfect solutions but then also realized that uploading them could potentially lead the readers to reach adopt bad practices/code.

      Due to the aforementioned reason, all of my uploaded solutions are IDENTICAL to the given solutions on the official site.

    • Programming Exercises

      1. Shapes (Jump to Solution) (Recommended)

      2. The Pie Chart (Jump to Solution)

      3. A Bouncing Ball (Jump to Solution) (Recommended)

      4. Precomputed Mirroring (Solution NOT PROVIDED)

  6. HTTP and Forms

    • This chapter, I believe, will be most useful to intermediate level learners who knows the basics of the language or client-side web development.

      A lot of semi-advanced topics are covered in this chapter, including the concept of AJAX calls using the fetch API or client-side storage facilities (in the form of localStorage or sessionStorage.

    • I definitely feel that the third programming exercise of this chapter, "Conway's Game of Life", is the best non-project based programming exercise of the book. Answering this question requires the knowledge of almost all of the lessons taught in the book.

      Also, the subject matter of the question is also exciting, because it is a simulation of "artificial life" on a grid of cells.

      Also, what makes this question even more appealing is the fact that you can approach it in a myriad of ways and make it as easy or difficult as you desire. You can also use this question as a foundation to a more feature-rich version of the simulation.

    • Programming Exercises

      1. Content Negotiation (Jump to Solution) (Recommended)

      2. A JavaScript Workbench (Jump to Solution) (Recommended)

      3. Conway's Game of Life (Jump to Solution) (Recommended)

  7. Project: A Pixel Art Editor (SKIPPED)

    • I have decided to skip this chapter even though, this is definitely the most complex project in the book because I simply don't have the time to study it.

      This is a wonderful project for anyone who is interested in doing graphics-heavy work on the web but unfortunately, I had different goals in mind, when I began with this ebook.

      My primary purpose was to learn the fundamentals of the JavaScript language and make myself familiar with the subject of DOM manipulation and performing HTTP(S) request(s) via AJAX calls. This was the main reason why I enjoyed Chapter 18 so much because it dealt with topics that I wished to learn in the first place.

    • Initially, I wanted to do a line-by-line analysis of the project but then I realized, my lack of interest would consequentially lead me to look at the solved solution set. This was something that I really didn't wish to do as I already felt guilty about basically uploading the solved solution set of Chapter 17.

      Hence, I have decided to not upload any kind of solutions since these are not mine. If the situation ever changes, I will update the repository.

    • Programming Exercises

      1. Keyboard Bindings (Solution NOT PROVIDED)

      2. Efficient Drawing (Solution NOT PROVIDED)

      3. Circles (Solution NOT PROVIDED)

      4. Proper Lines (Solution NOT PROVIDED)

Part 3: Node


  1. Node.js

  2. Project: Skill Sharing Website (SKIPPED)

    • I have decided to skip the final chapter of the e-book version of Eloquent JavaScript (3rd edition) simply because I am in a rush to complete this book and this reminds me of my current job, as a backend (Django) developer.

      I know that the reason sounds petty (and in some ways, it definitely is) but I have already given this book more time than I had initially desired. It took me nearly 2 months to complete this book which far exceeds my initial estimation of 4-5 weeks, partially due to my professional life coming in the way and my own laziness.

      I never wanted to end the book in this fashion but at this point, I want to utilize my newfound knowledge in some of my ongoing projects as well as move to other things that I have kept delaying to complete this book.

    • Programming Exercises

      1. Disk Persistence (Solution NOT PROVIDED)

      2. Comment Field Resets (Solution NOT PROVIDED)

Final Thoughts


I had a wonderful time reading and completing this book, even though, I have to admit that I didn't expect that it would have taken me nearly 2 months to finish it... But, I am so glad that I did it.

I loved the first section of the book... I think that the concepts were beautifully explained and very well complemented by the end-of-chapter exercises... The only chapter where I felt things could have been more clearly was the 11th chapter which focused on the subject of "Asynchronous Programming" in JavaSceipt.

But, it is a subject that I believe, is indeed quite a difficult one to teach and I commend the efforts made by the author (Marijn Haverbeke), to try and use a different approach to make us understand the subject...

The second section was, I believe, quite lengthy but it was definitely worth it... All the chapters were fabulously written and projects were challenging, exciting and fun. I wish that I could have completed the "Pixel Art Editor" project because it was implemented in a simple but effective manner.

This section also contained my most favourite exercise of the book in the form of "Conway's Game of Life" simulation in the 18th chapter of the book. I absolutely loved the exercise and I couldn't recommend it enough...

And finally, I had a mixed bag experience with the third & final section of the book which focused on the subject of Node.js, a runtime environment (based on Chrome's V8 engine) which allows us to execute JS code in the backend (on our machines systems, independent of browsers).

I liked the way that Chapter 20 introduced us to some of the key stuff of the Node environment and Chapter 21's project looks like a really good one... It's unfortunate that I skipped the section's project in the form of implementing a skill-sharing website due to my ardent desire to end this add this book into my list of completed reads.

To summarize, I don't think that I could have selected a better book to introduce me to the fundamentals of the modern JavaScript and I am sure that it will continue to remain as a near-constant reference guide (as well as my notes while reading this book) for the forseeable future.

About

My solutions to the Programming Assignment Questions given at the end of chapters of the book, "Eloquent JavaScript 3rd Edition" by Marijn Haverbeke (https://eloquentjavascript.net/). [Completed]

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published