Open AlinaTaoRao opened 2 years ago
What went less well?
- there are a long list of array method, but I just know a few of them, so a lot to learn. You can always use MDN docs for reference anytime.
- write and use callback function. Start experimenting with a simple callback functions ,nothing fancy. Once you get hang of it, you can write more complex ones.
@gelilaa
You can always use MDN docs for reference anytime.
Start experimenting with a simple callback functions
Very useful advice. Thanks! π
try
, catch
, toThrow
library
, jest
. New for me. How deep should I know about it?
write unit test with try, catch, toThrow
These are both π learning objectives, you don't need to know them. If you have time you can keep studying this but only after you're comfortable with everything else.
About library, jest. New for me. How deep should I know about it?
All you need to know deeply for now is describe
, it
, and expect(_).toEqual(_)
. There is the npm command for running tests from VSCode, that uses Jest but you don't need to understand how Jest works. Just how to read the test results
@colevandersWands Thanks for your answer. Now I can confidently focus on those basic but essential exercises. π
sort numbers
. For me continue
is logical in this function, but when I made PR , Lint-CI throw error: "Unexpected use of continue statement (no-continue)", why? Is this a problem from continue
or it's a problem from continue
in this function.
my PRconst sortNumbers3 = (number = []) => {
const copyOfNumber = number.map((x) => x);
// sort the copyOfNumber
for (let j=1; j<copyOfNumber.length; j++) {
let i;
for(i=0; i<j; i++) {
// find the one that is larger than copyOfNumber[j]
if (copyOfNumber[j] < copyOfNumber[i]) {
break;
}
}
if(i===j) {continue;} // error: Unexpected use of continue statement (no-continue)
// insert copyOfNumber[j]
const temp = copyOfNumber[j];
for(let k=j-1; k>=i; k--) { // shift one position to right
copyOfNumber[k+1] = copyOfNumber[k]
}
copyOfNumber[i]= temp; // insert copyOfNumber[j]
}
return copyOfNumber;
};
practice-code-review. I joined a study group and it helps me to adapt to the git workflow.
Read and fix lint: CI errors.
Many ways to handle lint-CI error from study group. Save me a lot of time.
but when I made PR , Lint-CI throw error: "Unexpected use of continue statement (no-continue)", why?
Continue is ok, it must be a configuration option I missed. Linting tools in JS land can get complicated, I'll update this rule in the repo and you can ignore it for now
@colevandersWands Thanks for your answer. π
[x] π₯ Analyzing Functions: You can analyze a function written at or near your level. This includes:
[x] π₯ Testing Existing Functions: You can write unit tests for a working function using the describe/it/expect().toEqual() syntax. This includes grouping test cases into logical test suites.
[x] π₯ Function Design: You can explain the function-design process and can successfully apply it to write 2+ solutions matching the behavior of a given function (assuming the behavior is at your level). The solutions do not need to implement different strategies, consider edge cases, or check for invalid arguments.
[ ] π₯ Generating Documentation: You can write a correct JSDoc for your functions and use a provided script to generate markdown documentation in a separate file.
[ ] π£ Declarative Programming: You can explain how Declarative Programming is different from Imperative programming, and can tell which paradigm is used in a program. You can also use built-in JS methods to write Declarative solutions to simple coding challenges.
[x] π£ Array Strategies: You can determine which of the primary array strategies (map, filter, reduce, every, some) are helpful for a specific problem at your level.
[x] π£ Higher-Order Functions in Array Methods: You can explain how a higher order function works, and write a callback for use in the primary array methods (for a problem at your level).
[ ] π£ Prototype Delegation: You can inspect a JS value in the browser's debugger/console and explain how to find which methods are available for that value.
[ ] π£ Nested Data: Given a nested data structure containing arrays, objects and primitive values, you can 1) access a given value 2) update a given entry 3) filter the data
[x] π£ Test-Driven Development: You can write basic unit tests for a problem you understand without having a solution to validate your tests. You can use your tests as a guide to develop a solution. You do not need to consider edge cases or invalid arguments.
[ ] π£ Fuzz Testing: You can interpret random test cases for a challenge to guide your development of a solution.
[x] π£ Testing Side-Effects: You can write a suite of unit tests to ensure that; 1) a function does not modify it's reference-type arguments, 2) the function returns a new array/object.
[ ] π£ ECMAScript Modules: You can use export const functionName = () => {}; and import { functionName } from './file-name.js' syntax to separate unit tests from the function definition.
[ ] π£ Continuous Integration: You can check CI scripts locally to ensure your code will pass CI checks when it is pushed, and can read CI results when conducting a code review.
[ ] π£ Code Review: You can use a provided checklist and passing/failing CI checks to review a classmate's function (given the solution is at your level).
[ ] π₯ Code Coverage: You can explain what code coverage is, why it's important, and can write unit tests for a code challenge with 100% coverage.
[ ] π₯ Testing Edge Cases: You can identify and write unit tests for tricky edge cases.
[ ] π Writing Guards: You can write guards for your function parameters that enforce the function's documented parameter types.
[ ] π Testing Guards: You can use expect(() => ).toThrow() to unit-test your guards' error type and message.