Javascript examples for String:substring
Return First Character of each word in a string
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*w w w .j a va2 s. c om*/ var name = "John P White This Test", data = name.split(' '), output = ""; for ( var i = 0; i < data.length; i++) { output += data[i].substring(0,1); } console.log(output); } </script> </head> <body> </body> </html>