Label templates
alert`123`; Alert (456) // These two are equivalent // template string can also be followed after the function name of the function will be called to handle // this is the template string tag templates / / label refers to the function of the string essentially immediately behind its template parameters // template string if there will be a variable parameter template into a plurality of string processing function and then calls the let a =. 8; the let B = 10; tag`hello $ {A + B} {A World $ `* B}; // equivalent to tag ([ 'hello', ' world', 18,80]) // tag is a function name the entire expression the return value // is the tag function returns the value of the post-processing template string
Template string
alert`123`; Alert (456) // These two are equivalent // template string can also be followed after the function name of the function will be called to handle // this is the template string tag templates / / label refers to the function of the string essentially immediately behind its template parameters // template string if there will be a variable parameter template into a plurality of string processing function and then calls the let a =. 8; the let B = 10; tag`hello $ {A + B} {A World $ `* B}; // equivalent to tag ([ 'hello', ' world', 18,80]) // tag is a function name the entire expression the return value // is the tag function returns the value of the post-processing template string