I’m using the following to get the title from a feed:
var posttitleGETcalendar = entry.title.$t;
var posttitleREMcalendar = posttitleGETcalendar.split("_");
var title = posttitleREMcalendar[0] + "<small>" + posttitleREMcalendar[1] + "</small>";
What I’m trying to do is split the titles I get after underscore and add the tag small to the part after it.
Works great when underscore is there, but it shows the word undefined after last word if underscore is not on title.
Is there a way to use
if underscore is on title, do
if not, leave it as is
Thank you.
alternatively, you could use the
replacemethod and skip the other auxilliar variables :