benjaminkent / assignments

This is where I'm keeping all of me SDG assignments
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.

benjaminkent commented 5 years ago

all tests pass. https://github.com/benjaminkent/function-junction

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

can be reduced to

const isVowel = a => {
  return (
    a === 'a' ||
    a === 'e' ||
    a === 'i' ||
    a === 'o' ||
    a === 'u' ||
    a === 'A' ||
    a === 'E' ||
    a === 'E' ||
    a === 'E' ||
    a === '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

Great job!

“Great job!” — via Jason L Perry