An open API service indexing awesome lists of open source software.

https://github.com/gitfoxcode/javascript-challenges

A collection of various javascript challenges, my solutions and so on
https://github.com/gitfoxcode/javascript-challenges

javascript

Last synced: 11 months ago
JSON representation

A collection of various javascript challenges, my solutions and so on

Awesome Lists containing this project

README

          

### Javascript Challenges
A collection of various tasks from the Internet that can be done in javascript. In `solutions` next to a given task there is my solution to a given problem and possibly the best solution and the fastest solution.

___
**#1 Characters, words and lines**
Write a function that takes a string as a
parameter. The function must count
characters, words and lines, returning an
object with these values. [@fabiocberg](https://www.instagram.com/p/Cf6IaacrP3h/)
```Javascript
// Complete the function
function pharseParser(pharse){
return;
}

pharseParser("Once upon a time")
// { characters: 16, words: 4, lines: 1 }

pharseParser("Happily Ever After")
// { characters: 18, words: 3, lines: 1 }

pharseParser("True courage is facing danger when you are afraid.\nThe Wizard of OZ")
// { characters: 70, words: 14, lines: 2 }
```