Pair programming
- Fork and clone repo at this repo
- run
npm installafter cloning to download external dependencies - Write a solution to each exercise and a corresponding test which ensures correctness of solution
- Try to write the test before writing the solution. This will force you to think closely about the task
- One person should be writing the test and another the solution. Alternate roles after each exercise
- Create at least two test for each question to cover different inputs and outputs
- Run
npm testregularly to ensure your tests pass - To run all tests in the background continuously you can do so using
npm test -- --watchAll
Exercises
longestString- Write a function which receives an array of strings. It should return the longest string from the array
l337Write a function which receives a string. It should replace all instances of letters below with corresponding number and return the resulting string
iorlwith number 1zwith the number 2ewith number 3awith number 4swith number 5gwith number 6torywith number 7bwith number 8qwith number 9owith number 0
uniqueStrings- Write a function which receives an array of strings. It should return an array of unique strings from the input array
developer- Create a constructor calledDeveloperwhich receives 2 parameters an input string containing name and an array of programming languages the developer knows
learn- using prototypal inheritance add a method toDevelopercalledlearnLanguage, which accepts a new language in string format and adds it to array of programming languages the developer knows. The values in array should be unique.
stringsConcat- Write a function which receives an array of strings and numbers. The function should concatenate all strings and return the resulting string.
negativeOnly- Write a function which receives one array of positive and negative numbers. It should return an array containing only the negative numbers
camelise- Write a function which receive a string of lower case, space separated words. It should convert the string to camel case. That is capitalise the first letter of every word except the first and remove all spaces
Stretch goals
isPrime- Write a function which receives an integer an returnstrueif the input is a prime number,falseotherwisewalkabout- create a constructor calledWalker. Walker should have one property an array calledjourney, which will store the journey taken. The last item in thejourneyarray represents the current location. The coordinates should be stored asx( horizontal) first andy(vertical) second. The initial location should be [0,0].- Add a
walkmethod toWalkerusing its prototype which accepts a direction as a stringN,S,E,Wand a number representing the number of steps to be taken. When called the walker should add the move made to itsjourneyhistory. A step inNdirection should increase theycoordinate. A step inSdirection should decrease theycoordinate. A step inWdirection should increase thexcoordinate. A step inEdirection should decrease thexcoordinate- Add a
currentLocationmethod toWalkerusing its prototype. It should return current location of the walker.- Add a
pathTakenmethod toWalkerusing its prototype. It should output the journey taken taken as a list of coordinates- Add a
totalStepsmethod toWalkerusing its prototype. It should output total steps walked