Skip to content

feat(totalIntegers): create exercise - #443

Merged
JoshDevHub merged 17 commits into
TheOdinProject:mainfrom
nik-contrib:feat/exercise_15
Dec 1, 2025
Merged

JoshDevHub merged 17 commits into
TheOdinProject:mainfrom
nik-contrib:feat/exercise_15

Conversation

@nik-rev

@nik-rev nik-rev commented Mar 23, 2024 •

Copy link
Copy Markdown
Contributor

Because

It was decided to add new recursion exercises

Previous

This PR

  • Adds exercise 15

Issue

Related to #27265

Additional Information

Pull Request Requirements

  • I have thoroughly read and understand The Odin Project Contributing Guide
  • The title of this PR follows the location of change: brief description of change format, e.g. 01_helloWorld: Update test cases
  • The Because section summarizes the reason for this PR
  • The This PR section has a bullet point list describing the changes in this PR
  • If this PR addresses an open issue, it is linked in the Issue section
  • If this PR includes any changes that affect the solution of an exercise, I've also updated the solution in the /solutions folder

@nik-rev
nik-rev marked this pull request as draft March 23, 2024 14:56
@nik-rev nik-rev changed the title New exercise | Total Integers (15) New exercise | Total Integers Mar 23, 2024
@nik-rev
nik-rev marked this pull request as ready for review March 24, 2024 14:32

@mao-sz mao-sz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General but important comment to consider for this one - I'll let you have a think about how you want to approach this.

  1. No need to reinvent the wheel for isInteger
  2. You only test nested arrays but what if there are objects within the array(s) that contain integer values?
    e.g.
[4, 6, { a: 1, b: { a: 10, b: 11 } }, 9]

@nik-rev

nik-rev commented Mar 24, 2024

Copy link
Copy Markdown
Contributor Author

General but important comment to consider for this one - I'll let you have a think about how you want to approach this.

  1. No need to reinvent the wheel for isInteger
  2. You only test nested arrays but what if there are objects within the array(s) that contain integer values?
    e.g.
[4, 6, { a: 1, b: { a: 10, b: 11 } }, 9]

Didn't know that method exists, how convenient!

Good point about the objects with numbers, that certainly makes the challenge more interesting

@nik-rev
nik-rev requested a review from mao-sz March 24, 2024 17:13
@mao-sz

mao-sz commented Mar 24, 2024

Copy link
Copy Markdown
Contributor

Didn't know that method exists, how convenient!

Pssst...

@nik-rev

nik-rev commented Mar 24, 2024

Copy link
Copy Markdown
Contributor Author

Didn't know that method exists, how convenient!

Pssst...

Wait whaaaat xD

@mao-sz mao-sz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't had time to assess the tests but at least in terms of how the solution is written, here are some suggestions.

Comment thread 15_totalIntegers/solution/totalIntegers-solution.js Outdated
Comment thread 15_totalIntegers/solution/totalIntegers-solution.js Outdated
Comment thread 15_totalIntegers/solution/totalIntegers-solution.js Outdated
@nik-rev nik-rev mentioned this pull request Apr 4, 2024
6 tasks done
nik-rev and others added 3 commits April 7, 2024 02:00
Co-authored-by: MaoShizhong <122839503+MaoShizhong@users.noreply.github.com>
Co-authored-by: MaoShizhong <122839503+MaoShizhong@users.noreply.github.com>
Co-authored-by: MaoShizhong <122839503+MaoShizhong@users.noreply.github.com>
@CouchofTomato
CouchofTomato requested a review from mao-sz April 7, 2024 15:41

@mao-sz mao-sz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 more general comments:

  • Don't forget to add .skip to all but the 1st test in the suite.
  • I know the earlier exercises use a traditional function expression but I think it may be sensible to have these new exercises use arrow functions, and also for the non-solution template. The older exercises can always be updated another time. @JoshDevHub, thoughts on having the exercises use arrow functions instead of traditional func expressions?

Comment thread 15_totalIntegers/solution/totalIntegers-solution.js Outdated
Comment thread 15_totalIntegers/solution/totalIntegers-solution.spec.js
Comment thread 15_totalIntegers/solution/totalIntegers-solution.js Outdated
@nik-rev

nik-rev commented Apr 7, 2024

Copy link
Copy Markdown
Contributor Author

2 more general comments:

  • Don't forget to add .skip to all but the 1st test in the suite.
  • I know the earlier exercises use a traditional function expression but I think it may be sensible to have these new exercises use arrow functions, and also for the non-solution template. The older exercises can always be updated another time. @JoshDevHub, thoughts on having the exercises use arrow functions instead of traditional func expressions?

For the first point, I am pretty sure that the .solution.spec files don't have any .skipped tests in any of the previous exercises. But yeah that will have to be done when I end up adding all the tests to the regular spec files.

Also I agree that it would be nice to have them all be arrow functions however I think consistency is important and it would be better to update them in a different PR. Also considering that the exercise generator tool would need to be updated too it would certainly have to all be in a separate PR.

@mao-sz

mao-sz commented Apr 7, 2024

Copy link
Copy Markdown
Contributor

Ah yes, the solution test suite doesn't. As long as the skips get added when you copy over for the non-solution test suite, then all is good 👍

Also fair point on the exercise generator tool - let's stick to trad. function expressions then.

@JoshDevHub JoshDevHub left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some thoughts. Let me know if you have any questions.

Comment thread 15_totalIntegers/solution/totalIntegers-solution.js Outdated
Comment thread 15_totalIntegers/solution/totalIntegers-solution.js Outdated
Comment thread 15_totalIntegers/solution/totalIntegers-solution.js Outdated
@nik-rev nik-rev changed the title (15) New exercise | Total Integers feat(totalIntegers): create exercise Aug 9, 2024
@mao-sz

mao-sz commented Aug 18, 2024

Copy link
Copy Markdown
Contributor

@nikitarevenco Any issues with the above comments from Josh?

@nik-rev

nik-rev commented Aug 18, 2024

Copy link
Copy Markdown
Contributor Author

@nikitarevenco Any issues with the above comments from Josh?

Ok, went over all the comments just now and added the suggestions

@nik-rev
nik-rev requested review from JoshDevHub and mao-sz August 18, 2024 17:34

@mao-sz mao-sz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the comment below, I'm happy to approve once the tests and appropriate skips have been copied over to the other spec file 🔥

Comment thread 15_totalIntegers/solution/totalIntegers-solution.js Outdated
@mao-sz mao-sz added the Status: Do Not Merge This PR should not be merged until further notice label Aug 20, 2024

@JoshDevHub JoshDevHub left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than Mao's one live comment, I think everything looks good with this.

@JoshDevHub JoshDevHub removed the Status: Do Not Merge This PR should not be merged until further notice label Dec 1, 2025
@JoshDevHub
JoshDevHub merged commit 496a3c3 into TheOdinProject:main Dec 1, 2025
painooo pushed a commit to painooo/javascript-exercises that referenced this pull request Dec 29, 2025
Paodpdro pushed a commit to Paodpdro/javascript-exercises that referenced this pull request May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants