Coder Social home page Coder Social logo

js-challenges-pt1's Introduction

JS Challenges Pt 1

Prereqs:

  • JS primitives
  • JS arrays
  • JS functions

Getting Started

  1. Fork and clone this repository
  2. Create a file in the js subdirectory for each solution name the same as the function specified
  3. Write a function for each of the following prompts
  4. Test your output by running the file with node

1. the Longest Word

Write a function that returns the length of the longest word in the provided sentence. Make sure not to include any punctuation in your count

Your response should be a number.

e.g.

getLongestWord("over the garden wall.") 
// expected output: 6
getLongestWord("I tripped on my own candy trail. Candy Camouflage!") 
// expected output: 10
function getLongestWord(str) {
  // No, Greg, a-a bird's brain isn't big enough for cognizant speech.
}

2. Titleize a Sentence

write a function that returns the provided string with the first letter of each word capitalized. Make sure the rest of the word is in lower case.

Bonus for the exclusion of smaller words like "the","of", and "and".

e.g.

titleize("oh, potatoes and molasses!") 
// expected output: "Oh, Potatoes And Molasses!"

titleize("hard times at the huskin' bee.") 
// Hard Times at the Huskin' Bee.
function titleize(str) {
  // if you want some, just ask us!
}

3. Chunk!

Write a function that takes two arguments, arr and length, that splits an array into groups of the specified length and returns them as a two-dimensional array.

If the array length is not evenly divisible by the specified length, the remaining items should still be in their own 2nd dimensional array. e.g.

chunkIt(["potatoes","molasses","greg","wirt"], 2) 
// expected output: [["potatoes","molasses"],["greg","wirt"]]
chunkIt(["potatoes","molasses","greg","wirt","beatrice","adelaide","mrs. whispers"], 3) 
// expected output: [["potatoes","molasses","greg"],["wirt","beatrice","adelaide"],["mrs. whispers"]]
function chunkIt(arr, length) {
  // We're burglars!
}

Licensing

  1. All content is licensed under a CC-BY-NC-SA 4.0 license.
  2. All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact [email protected].

js-challenges-pt1's People

Contributors

shullmb avatar taylordarneille avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.