For each exercise, choose one person to whiteboard a potential solution. Then, the person who whiteboarded the problem is the navigator in a pair programming exercise to implement the solution described.
For then second problem, reverse roles. The person who listened (and was the pilot) will whiteboard the solution and act as navigatior when implementing.
JavaScript provides an Array.reverse
function. For practice, we're going to write something similar. Neither solution should use the reverse function. Write a function called reverseArray()
that takes an array, ar
, as an argument and returns a new array that has the same elements as ar
, but in reverse order.
Write a function called reverseArrayInPlace()
that takes an array ar
as an argument and returns the same array modified to have its elements in reverse order.
Build a function that takes a string as a parameter and returns whether or not that string is a palindrome. A string is a palindrome if, when reversed, it reads the same. Example: "tacocat".
Modify the palindrome function to optionally (default true
) include spaces when determining if the provided string is a palindrome.