generateHashtag(" Hello there thanks for trying my Kata"); // "#HelloThereThanksForTryingMyKata"
generateHashtag(" Hello World " ); // "#HelloWorld"
generateHashtag("" ); // false
generateHashtag("a".repeat(140)) ); // false
capitalize("el cielo es azul"); // El cielo es azul
capitalize("a"); // A
capitalize([]); // ""
capitalize("la casa azul", true); // El Cielo Es Azul
[
{nombre:"Juan", edad:18},
{nombre:"Manuel", edad:12},
{nombre:"Alberto", edad:15}
]
[
{nombre:"Manuel", edad:12},
{nombre:"Alberto", edad:15},
{nombre:"Juan", edad:18}
]
factorial(5); // "120"
factorial(25); // "15511210043330985984000000"
$array=[
['product_id' => 'p100', 'nombre' => 'Mesa'],
['product_id' => 'p200', 'nombre' => 'Silla'],
['product_id' => 'p300', 'nombre' => 'Television'],
];
print_r(getValues($array, 'product_id')); // ['p100', 'p200', 'p300']
print_r(getValues($array, 'nombre')); // ['Mesa', 'Silla', 'Television']
print_r(getValues($array, 'direccion')); // ['', '', ''] (No existe el key: direccion)
pigIt('Pig latin is cool'); // igPay atinlay siay oolcay
pigIt('Hello world !'); // elloHay orldway !
var helper = new PaginationHelper(['a','b','c','d','e','f'], 4);
helper.pageCount(); // 2
helper.itemCount(); // 6
helper.pageItemCount(0); // 4
helper.pageItemCount(1); // last page 2
helper.pageItemCount(2); // -1 since the page is invalid
// pageIndex takes an item index and returns the page that it belongs on
helper.pageIndex(5); // 1 (zero based index)
helper.pageIndex(2); // 0
helper.pageIndex(20); // -1
helper.pageIndex(-10); // -1
dirReduc(["NORTH", "SOUTH", "SOUTH", "EAST", "WEST", "NORTH", "WEST"]); // [WEST]
dirReduc(['SOUTH', 'NORTH', 'EAST', 'WEST', 'NORTH', 'SOUTH', 'NORTH', 'NORTH', 'NORTH', 'WEST', 'EAST', 'SOUTH', 'NORTH', 'EAST', 'WEST']); // ["NORTH", "NORTH", "NORTH"]