//working on every kind of name
const getInitials = function (name) {
const names = name.split(" ");
const initialsArr = [];
const initials = names.shift().charAt(0) + " " + names.pop().charAt(0);
initialsArr.push(initials.toUpperCase());
initialsArr.join(" ");
};
getInitials(
"Pablo Diego José Francisco de Paula Juan Nepomuceno María de los Remedios Cipriano de la Santísima Trinidad Ruiz y Picasso"
); //Output: P P