๐ŸŒ
Eloquent JavaScript
eloquentjavascript.net โ€บ code
Eloquent JavaScript :: Code Sandbox
You can use this page to download source code and solutions to exercises for the book Eloquent JavaScript, and to directly run code in the context of chapters from that book, either to solve exercises to simply play around ยท If you've solved the exercise and want to compare your code with ...
๐ŸŒ
Urry
eloquent-javascript-solutions.urry.me
Eloquent JavaScript Solutions - 3rd Edition.
These are Jon Urry 's solutions to the exercises and problems set in the 3rd edition of eloquent javascript by Marijn Haverbeke.
Discussions

Solutions for 3rd edition Eloquent JS?
https://eloquentjavascript.net/3rd_edition/code/ More on reddit.com
๐ŸŒ r/learnjavascript
5
15
March 5, 2018
Eloquent JavaScript 2nd Edition recursion exercise solution - Stack Overflow
I attempted to solve the recursion exercise of the online book eloquentjavascript 2nd edition: Here is what the question states: Weโ€™ve seen that % (the remainder operator) can be used to test wh... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Eloquent Javascript Exercises - Javascript Course 2021 - Moralis Academy Forum
A place to discuss questions, approaches and solutions to the exercises found in the Eloquent Javascript book. More on studygroup.moralis.io
๐ŸŒ studygroup.moralis.io
4
1
January 19, 2022
Eloquent JavaScript ch5 - "Your own loop" solution (loop vs recursion) - Stack Overflow
I really did overflow the stack on my first try, but then I put the return statement (see comment in code) without an argument and it worked. Task: Write a higher-order function loop that provides More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
GitHub
github.com โ€บ SuyashD95 โ€บ eloquent-js-solutions
GitHub - SuyashD95/eloquent-js-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/). [Completed]
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] - SuyashD95/eloquent-js-solutions
Starred by 66 users
Forked by 20 users
Languages ย  JavaScript 83.0% | HTML 16.2% | CSS 0.8% | JavaScript 83.0% | HTML 16.2% | CSS 0.8%
๐ŸŒ
GitHub
github.com โ€บ 0mppula โ€บ Eloquent_JavaScript_Third_Edition
GitHub - 0mppula/Eloquent_JavaScript_Third_Edition: Solutions to the exercises from the ebook 'Eloquent JavaScript, 3rd Edition' by: Marjin Haverbeke. ยท GitHub
Solutions to exercises from the ebook "Eloquent JavaScript, 3rd Edition" by: Marijn Haverbeke.
Starred by 6 users
Forked by 2 users
Languages ย  JavaScript 95.3% | HTML 3.8% | CSS 0.9%
๐ŸŒ
GitHub
github.com โ€บ marijnh โ€บ Eloquent-JavaScript โ€บ tree โ€บ master โ€บ code โ€บ solutions
Eloquent-JavaScript/code/solutions at master ยท marijnh/Eloquent-JavaScript
The sources for the Eloquent JavaScript book. Contribute to marijnh/Eloquent-JavaScript development by creating an account on GitHub.
Author ย  marijnh
๐ŸŒ
Eloquent JavaScript
eloquentjavascript.net โ€บ 2nd_edition โ€บ 02_program_structure.html
Program Structure :: Eloquent JavaScript
The second version of the program has a straightforward solution and a clever one. The simple way is to add another โ€œbranchโ€ to precisely test the given condition.
๐ŸŒ
Eloquent JavaScript
eloquentjavascript.net
Eloquent JavaScript
A paper version of Eloquent JavaScript, including an additional chapter, is being brought out by No Starch Press. Code sandbox and exercise solutions ยท Errata for the paper book ยท This book as a single PDF file (& small version for mobile) This book as an EPUB file ยท
๐ŸŒ
Jesse Szepieniec
jessems.com โ€บ posts โ€บ 2020-12-09-eloquent-javascript-exercises
My solutions to exercises in 'Eloquent JavaScript' - jessems
Last update: December 10th, 2020 ยท A list is a nested set of objects, with the first object holding a reference to the second, the second to the third, and so on
Find elsewhere
๐ŸŒ
Reddit
reddit.com โ€บ r/learnjavascript โ€บ solutions for 3rd edition eloquent js?
r/learnjavascript on Reddit: Solutions for 3rd edition Eloquent JS?
March 5, 2018 -

I realize it's only a draft edition, and it's not officially out yet. However I am doing the exercises and can't find any solutions to them, except for the ones that stayed the same. Does anyone know if they're available somewhere?

In case you're feeling like helping me out, I'm currently kind of stuck, and described my problem on pastebin.

I'll publish the solutions I have so far on my GitHub, since it seems no one has done so yet.

Cheers.

Top answer
1 of 2
5
https://eloquentjavascript.net/3rd_edition/code/
2 of 2
1
I haven't seen any collection of solution for 3rd edition yet, so I'll try to help you with your current problem. You code is super close to being right, so if you feel like it "clicked" while reading my response, feel free to stop reading and go solve the rest yourself. First, you have to return value under the property name value, and not val, from your iterator โ€” it's one of those "defined in the standard" things, so if we fix that kink, we should see some meaningful output in console: class GroupIterator { constructor(group) { this.group = group; this.item = 0; } next() { if (this.item == this.group.array.length) { return { done: true }; } this.item++; return { value: this.item, done: false }; // changed } } for (let value of Group.from(["a", "b", "c"])) { console.log(value); } //> 1 //> 2 //> 3 Which makes sense, right? We start with this.item set to 0, and, while iterating, increment and return it. Since we have 3 items in the Group that is being iterated over, we get 1, 2, 3. So how can we use these numbers? We have access to the underlying array that holds values in our group, this.group.array, so we can try using this.item as an index, to get specific item from the group's array: class GroupIterator { constructor(group) { this.group = group; this.item = 0; } next() { if (this.item == this.group.array.length) { return { done: true }; } this.item++; return { value: this.group.array[this.item], done: false }; // changed } } for (let value of Group.from(["a", "b", "c"])) { console.log(value); } //> "b" //> "c" //> undefined Oops, off-by-one error! You might remember that in the book this is handled a bit differently , namely value that we want to return is constructed before incrementing current indexes of the matrix, so let's do the same: class GroupIterator { constructor(group) { this.group = group; this.item = 0; } next() { if (this.item == this.group.array.length) { return { done: true }; } let value = this.group.array[this.item]; // added this.item++; return { value, done: false }; // changed } } for (let value of Group.from(["a", "b", "c"])) { console.log(value); } //> "a" //> "b" //> "c" And there we go, our Group is now iterable. While we are at it, we might as well name this.item for what it is โ€” this.currentIndex; I think it's a bit better name for it. And that should be the full solution .
๐ŸŒ
Medium
medium.com โ€บ the-command-line โ€บ eloquent-exercises-groups-eloquent-javascript-chapter-6-f21a2c86ac1b
Eloquent Exercises: Groups | Eloquent Javascript, Chapter 6 | by Dan Eder | The Command Line | Medium
April 29, 2022 - In this series, Iโ€™ll be breaking down my solutions to exercises in Eloquent Javascript by Marijn Haverbeke. All credit for the exerciseโ€ฆ
๐ŸŒ
GitHub
github.com โ€บ MarcusPlieninger โ€บ eloquent-js
GitHub - MarcusPlieninger/eloquent-js: Solutions to exercises in "Eloquent Javascript, 3rd Edition" by Marijn Haverbeke with tests written using the Jest testing framework
Solutions to exercises in "Eloquent Javascript, 3rd Edition" by Marijn Haverbeke with tests written using the Jest testing framework - MarcusPlieninger/eloquent-js
Author ย  MarcusPlieninger
๐ŸŒ
Nucamp
nucamp.co โ€บ blog โ€บ eloquent-javascript-are-there-solutions-to-eloquent-javascript-exercises
Are there solutions to "Eloquent JavaScript" exercises?
April 9, 2024 - Written by Marijn Haverbeke, the book offers essential JavaScript learning, spanning basic to advanced topics. Find official solutions on the book's website and explore unofficial ones on platforms like GitHub and Stack Overflow.
๐ŸŒ
Moralis
studygroup.moralis.io โ€บ javascript course 2021
Eloquent Javascript Exercises - Javascript Course 2021 - Moralis Academy Forum
January 19, 2022 - A place to discuss questions, approaches and solutions to the exercises found in the Eloquent Javascript book.
Top answer
1 of 2
3

Yes, that's the correct recursive implementation for the task. You didn't just hit the correct output by chance.

The else return is a bit odd though. I would have written either

function loop(value, test, update, execute) {
  if (test(value)) {
    execute(value);
    return loop(update(value), test, update, execute);
  } // else stop
}

or

function loop(value, test, update, execute) {
  if (!test(value)) return; // stop
  execute(value);
  return loop(update(value), test, update, execute);
}
2 of 2
2

Initializer

The book solution creates a value variable and initializes it with start. In your case this happens automatically when you pass your first parameter. So far the two approaches are equivalent.

Test

The for loop calls test(value) as cycle test. Your approach does something similar, but calling test is the test for recursion. So far the two approaches are equivalent.

Cycle block

The for loop calls body(value). Your approach calls execute(value). So far the two approaches are equivalent.

The update

value is updated in the cycle after each iteration. The same happens in your code when you pass update(value) in your recursive call. So far the two approaches are equivalent.

Are they really equivalent?

Algorithmically, yes. Technically, no. Your recursive approach calls the function several times and uses the stack (of the memory) to store the function calls. In the case of a too large numbers of test, your code will crash. So, you have successfully implemented a recursive version of the book example (yay!) but you should try to avoid recursion in most cases.

๐ŸŒ
GitHub
github.com โ€บ cristiand391 โ€บ eloquent-js-solutions
GitHub - cristiand391/eloquent-js-solutions: My solutions to exercises in Eloquent JavaScript
My solutions to exercises in Eloquent JavaScript. Contribute to cristiand391/eloquent-js-solutions development by creating an account on GitHub.
Author ย  cristiand391
๐ŸŒ
eloquent-javascript
ulti.js.org โ€บ eloquent-javascript
Eloquent JavaScript | eloquent-javascript
๐Ÿ” Eloquent JavaScript Notes and challenges solved with TypeScript, TDD and love
๐ŸŒ
Quora
quora.com โ€บ Are-the-exercises-in-eloquent-JavaScript-intended-to-be-difficult-Is-it-normal-to-find-them-extra-challenging
Are the exercises in eloquent JavaScript intended to be difficult? Is it normal to find them extra challenging? - Quora
Answer (1 of 2): Yes, they are meant to be that way, but they are solvable by anyone reading the material carefull. If they donโ€™t put you in difficulty then they are not efficient. That is their purpose, to make you think differently about what you learned. They help you commit to memory what y...
๐ŸŒ
Sololearn
sololearn.com โ€บ en โ€บ Discuss โ€บ 1649578 โ€บ eloquent-javascript
ELOQUENT JavaScript | Sololearn: Learn to code for FREE!
Eloquent JavaScript https://eloquentjavascript.net/ Before asking a question on the Q/A, try to search : โ€ข Google Advanced Search : Set domain to ใ€‹sololearn.comใ€Š for search only on the SoloLearn https://www.google.com/advanced_search โ€ข Eclipse Wiki : "Before asking a question on the forums" https://wiki.eclipse.org/Before_asking_a_question_on_the_forums โ€ข SoloLearn Advanced Search : http://www.freecodeexamples.com/2018/12/sololearn-advanced-search.html https://code.sololearn.com/W26q4WtwSP8W/?ref=app
๐ŸŒ
Thecodingdiaries
thecodingdiaries.com โ€บ re-reading-eloquent-javascript
Re-reading Eloquent Javascript
To solve this, we had to truly understand what the .join() and .split() methods did in javascript.