Get help on our basic JavaScript and Algorithms Challenges. If you are posting code that is large use Gist - https://gist.github.com/ paste the link here.
thecodingaviator on master
remove A (#31157) (compare)
function titleCase(str) {
str = str.split(' ').map(function(value){
return value.split('').unshift(value.shift().toUpperCase).join();
}).join();
return str;
}
titleCase("I'm a little tea pot");
function titleCase(str) {
str = str.split(' ').map(function(value){
return value.split('').unshift(value.split('').shift().toUpperCase).join();
}).join();
return str;
}
titleCase("I'm a little tea pot");
function destroyer(arr) {
var args = [].slice.call(arguments);
var slice = args.slice(1);
// slice = [2,3]
// arr = [1, 2, 3, 1, 2, 3]
// args = [[1, 2, 3, 1, 2, 3], 2, 3]
function filter(value) {
return value === slice;
}
var seek = arr.filter(filter);
return seek.indexOf(slice) === -1;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3, 4);