Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

get first and last word initials from name

//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
Comment

PREVIOUS NEXT
Code Example
Javascript :: Backbone Render And Initialize 
Javascript :: fetch Mongodb find() results with Backbone 
Javascript :: javascript get hours and minutes from date 
Javascript :: jquery ajax snippet 
Javascript :: RTC measure react native undefined 
Javascript :: How to Compare Strings Using localeCompare 
Javascript :: how to add element in array in angular 
Javascript :: Angular active router change event 
Javascript :: react button onclick components refined #1 
Javascript :: finding the smallest number other than 0 in an array javascript 
Javascript :: removes all item occurrences in array 
Javascript :: Will Yield An Object 
Javascript :: remove nth character from string javascript 
Javascript :: Backbone Sync And Fetch Example 
Javascript :: tiled spatialmaterial godot 
Javascript :: get file name with extension netsuite suitescript 
Javascript :: Shopify cart context 
Javascript :: react random string 
Javascript :: broken image 
Javascript :: javascript pad 
Javascript :: javascript custom table 
Javascript :: verifier si chaien ade caractere apparait dans autre js 
Javascript :: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.0:compile 
Javascript :: firebase hosting rewrite function You need to enable JavaScript to run this app. 
Javascript :: stack overflow multiselect error react 
Javascript :: correct code for the { "vars": "local" } 
Javascript :: button onclick link to another page react 
Javascript :: copy multi cell value from one sheet to another using google app script 
Javascript :: js how to shuffle array algoritm. The Fisher-Yates algorith 
Javascript :: jsf localdate converter 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =