import { CodeSurfer, CodeSurferColumns, Step, } from "code-surfer"; import { github, vsDark } from "@code-surfer/themes"; import Html from "./src/components/Html.js"; import BlockQuote from "./src/components/BlockQuote.js";
export const theme = vsDark;
Hello 👋, Welcome to the readability challenge.
This challenge is based on 4Geeks proposed Coding Guidelines.
Use your arrow keys to move ->
<CodeSurferColumns sizes={[1, 2]}>
Indentation Always Be Closing Almost all tags should be at the beginning of the lineOnly small lines should close at the end of the same linelong texts must have a line-length limit of around 80 characters
<CodeSurferColumns themes={[github, vsDark]}>
<CodeSurferColumns sizes={[1, 2]}>
Why do you think using global variables is wrong in this code?Why is the `accumulate` risky?Its hard to keep track of the `result` valueSwitching the order of the lines generates a very different output
<CodeSurferColumns themes={[github, vsDark]}>
<CodeSurferColumns sizes={[1, 2]}>
How can you accumulate without global variables?Store the result in a variable and pass it to the next function call
<CodeSurferColumns sizes={[1, 2]}>
How can we remove the "else" statement from this function?More than 50% of the time, else statements are not neededWe know that "return" statements stop the function execution.This line of code will never execute if age >= 16
<CodeSurferColumns sizes={[1, 2]}>
How can this code be improved?Avoid nesting conditionals
<CodeSurferColumns themes={[github, vsDark]}>
- Let's split the class in as many groups as possible as long as there is one mentor in each group.
- For example: If there are 2 mentors in a class of 10 students, then we will have 2 groups of 5 students each.
- Open old projects and propose refactoring options that do follow the coding guidelines.