Tagged Template in JavaScript
Level 3123 keystrokes
Calls a function with a template literal so the function can transform the inserted value.
JavaScript code
1function tag(strings, name) { // strings holds the fixed text pieces; name is the inserted value2 return strings.join(name.toUpperCase());3}4const user = "ann";// Writing tag before the template calls tag with its parts, so this prints Hi ANN!5console.log(tag`Hi ${user}!`);Output
Hi ANN!
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this JavaScript code and how often they appear.
(× 4)× 4;× 3.× 3"× 2{× 2}× 2`× 2,× 1!× 1