I have an array. Within it I have 2 names. I want to pick only the surname by a split function, but it is not working. I have separated first name and last name using an underscore.
function spt (){
var m= new Array('jitender_chand','shashi_cant')
var j= m.split('_');
document.getElementById('add').innerHTML=j;
}
<body>
<input type="text" value="hii" id="jitender" />
<input type="button" onclick="spt()" />
<div id="add" ></div>