Psst: Open the JavaScript Console and try to play around with these functions:
reverse('awesome') // should return 'emosewa'
isPalindrome('tacocat') // should return true
someRecursive([4,6,8,9], val => val % 2 !== 0) // should return true
everyRecursive([4,6,8], val => val % 2 === 0) // should return true
flatten([1, [2, [3, 4], [[5]]]]) // should return [1, 2, 3, 4, 5]
capitalizeFirst(['car','taco','banana']); // should return
['Car','Taco','Banana']
let obj1 = {
a: 2,
b: {b: 2, bb: {b: 3, bb: {b: 2}}},
c: {c: {c: 2}, cc: 'ball', ccc: 5},
d: 1,
e: {e: {e: 2}, ee: 'car'}
};
nestedEvenSum(obj1); // should return 10
capitalizeWords(['i', 'am', 'learning', 'recursion']); // should
return ['I', 'AM', 'LEARNING', 'RECURSION']
let obj2 = {
num: 1,
test: [],
data: {
val: 4,
info: {
isRight: true,
random: 66
}
}
};
stringifyNumbers(obj2);
// should return the ff. object:
/*
{
num: "1",
test: [],
data: {
val: "4",
info: {
isRight: true,
random: "66"
}
}
}
*/
let obj3 = {
stuff: "foo",
data: {
val: {
thing: {
info: "bar",
moreInfo: {
someMoreInfo: {
num: 42069
},
evenMoreInfo: {
weMadeIt: "baz"
}
}
}
}
}
}
collectStrings(obj3) // should return ["foo", "bar", "baz"])