Repository navigation
London | 26-ITP-Sept | Fung Nin Lee | Sprint 1 | Sprint-1 exercise - #1496
leerogerfn wants to merge 19 commits into
Conversation
There was a problem hiding this comment.
-
How should the function handle an array containing
NaN? -
How should the function handle an array containing elements that are not numbers or strings (e.g.,
null,undefined,true,console(object), etc.)?
There was a problem hiding this comment.
The assessment seems do not require to handle NaN and array which are neither numbers nor strings.
There was a problem hiding this comment.
-
NaNis also a value of type "number". HandlingNaNis optional in this exercise but you should find out how to check if a value is notNaN. -
The comment in
max.test.jsdoes mention "any value that isn't a number"// Given an array containing a value that isn't a number // When passed to the max function // Then it should throw Error("findMax requires an array of numbers")So the function should also be able to throw an error when the given array contains any value that is not a number.
There was a problem hiding this comment.
What should calculateMean([Infinity, 0, -Infinity]) or calculateMean([0, NaN]) return?
The same also applies to sum().
There was a problem hiding this comment.
The assessment seems do not require to handle the scenario you mentioned.
There was a problem hiding this comment.
-Infinity and Infinity are also values of type "number". Change is optional, but you should find out how to check if a number is not one of them.
cjyuan
left a comment
There was a problem hiding this comment.
Changes look good, but some of the code is not consistently formatted.
Suggestion:
- Look up the benefits of using a code formatter.
- Install the Prettier extension for VS Code, then:
- Use VS Code's Format Document feature to format your code.
- Optionally, enable Format On Save and Format On Paste to keep your code consistently formatted.
Resource: Visual Studio Code - Formatting
Note: The formatter may not work correctly if your code contains syntax errors.
Learners, PR Template
Self checklist
Task code
CYF-1071
Changelist
completed exercises of Data Group Sprint-1