This quiz is test some more knowledge of some javascript skills you'll need to have in a web development job.
- Longest String - Given an array of items, return the longest string in the array. There may be things that aren't strings passed into the array.
longestString([
'foo',
'bar',
'test'
]) === 'test';
longestString([
573927,
{foo: 'bar'},
['hello', 'world', 'i', 'am', 'sentient'],
'blah'
]) === 'blah';
- arraySum - Given an array, sum up all of the items in the array, and in all of the sub-arrays.
arraySum([1, 2, 3, 4]) === 10;
arraySum([
10,
[1, 2, 3, 4],
[1, [2, 3], 4]
]) === 30;
- bindName - Given a first name, last name, and a function, return a new function who's first argument will always be the first and last names combined with a space between them.
let helloMe = bindName('Keith', 'Smith', function (name, message) {
return message + ', ' + name;
});
helloMe('Hello') === 'Hello, Keith Smith';