Skip to content

Zeniscribbles/sumofnumbers

Repository files navigation

UH Manoa ICS314 Practice WOD: Sum of Numbers

For this practice WOD, solve the following variation of the first of the five problems that Santiago Valdarrama thinks should take less than an hour.

Ready? Let’s begin:

  1. Start your timer.

  2. Create an empty GitHub repo called “sumofnumbers” and clone it to your local computer. Don’t forget to check the box so that a README file is created.

  3. Open the local repo in VSCode.

  4. Set up your project to use our Typescript coding standards. Download five files into your project directory:

    • sample.eslintrc.js, rename it to .eslintrc.js.
    • sample.eslintignore, rename it to .eslintignore.
    • sample.gitignore, rename it to .gitignore.
    • sample.package.json, rename it to package.json.
    • sample.tsconfig.json, rename it to tsconfig.json.
  5. Invoke npm install to install ESLint.

  6. Create two files: index.html and sumofnumbers.ts. The index.html should load the sumofnumbers.js file. Remember to compile your Typescript file to Javascript. Use npx tsc to compile your Typescript file.

  7. Write four functions that return the sum of the numbers in a given list using:

    • a for-loop,
    • a while-loop,
    • recursion, and
    • Array functional programming.

    Call them sumFor, sumWhile, sumRecursion, and sumTheFunctionalWay. Add console.log statements to each function to show the result. For example, console.log(sumFor([1, 2, 3, 4])); should output 10. Check the output in the browser console.

  8. Make sure ESLint is running. For example, add newlines to the end of a file to see that an ESLint error is triggered.

  9. Make sure that there are no red ESLint errors indicating ESLint does not detect any problems with your code.

  10. Commit your finished program to GitHub.

  11. Check that your code is on GitHub.

  12. Stop your timer and record your time. Be sure to record it, because you will need your WOD time data when you write your technical essay.

About

ICS314 Assignment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published