gabeo14 / assignments

Assignments for SCDG
0 stars 0 forks source link

Week 05 Day 2 - Function Junction #17

Closed gstark closed 5 years ago

gstark commented 5 years ago

Objectives

After completing this assignment, you should be able to:

Requirements

  1. Fork this repository to your own account.
  2. Change into your training directory
  3. Clone your repository: hub clone function-junction
  4. Change into your project's directory: cd function-junction
  5. Install the dependencies: yarn install (or just yarn for short)
  6. Open in Code: code .
  7. Start the test runner: yarn test
  8. Open src/functions.test.js and work on functions until tests pass.
  9. Commit and push your work to GitHub.
  10. Turn in the URL to your GitHub repo.

Explorer Mode

Adventure Mode

Epic Mode

Additional Resources

Reference the documentation on MDN to find what kind of helpful functions might already be on Array and String in JavaScript.

gabeo14 commented 5 years ago

https://github.com/gabeo14/function-junction

don't have rovarspraket yet, so I'll come back and reopen this to do it when I get the chance.

Thanks Gavin

gstark commented 5 years ago
function isVowel(ltr) {
  if (
    ltr === 'a' ||
    ltr === 'e' ||
    ltr === 'i' ||
    ltr === 'o' ||
    ltr === 'u' ||
    ltr === 'A' ||
    ltr === 'E' ||
    ltr === 'I' ||
    ltr === 'O' ||
    ltr === 'U'
  ) {
    return true
  } else {
    return false
  }
}

can just be

function isVowel(ltr) {
  return (
    ltr === 'a' ||
    ltr === 'e' ||
    ltr === 'i' ||
    ltr === 'o' ||
    ltr === 'u' ||
    ltr === 'A' ||
    ltr === 'E' ||
    ltr === 'I' ||
    ltr === 'O' ||
    ltr === 'U'
  )
}

since

if (condition) {
  return true
} else {
  return false
}

is the same as

return condition
gstark commented 5 years ago

Your homework was marked: Meets Expectations

With LASERS

“With LASERS” — via Jason L Perry