You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
letperson='Mike';letage=28;functionmyTag(strings,personExp,ageExp){letstr0=strings[0];// "That "letstr1=strings[1];// " is a "letstr2=strings[2];// "."letageStr;if(ageExp>99){ageStr='centenarian';}else{ageStr='youngster';}// We can even return a string built using a template literalreturn`${str0}${personExp}${str1}${ageStr}${str2}`;}letoutput=myTag`That ${person} is a ${age}.`;console.log(output);// That Mike is a youngster.
Today I learned about template strings functions!
source - mdn
The text was updated successfully, but these errors were encountered: