Why does not js code work on any version of IE?

enter image description here


Code:

var titleSearch = ` <div class="row"> <div class="col-sm-6"> <div class="page-title"> <h1>Поиск <small>`+ quantityProduct +`</small></h1> </div> </div> </div> `; 

    1 answer 1

    PS
    I decided to make a question and answer because I had to kill for several days in search of an answer (and then changed everything into quotes for another couple of days), I hope it will be useful to someone. (If there is another solution, I will be happy to answer in the comments).

    IE does not support wildcard ``.
    All code that contains similar `characters will have to be rewritten into quotes and concatenation (addition, example:" Hello "+" world! ") .

    Decision:

     var titleSearch = '<div class="row">' + '<div class="col-sm-6">' + '<div class="page-title">' + '<h1>Поиск <small>(Всего 1 товар)</small></h1>' + '</div>' + '</div>' + '</div>'; 
    • Well, of course it’s not a duplicate and there is a benefit, but in the case of such specific errors, it’s worth checking for support of one or another syntax: caniuse.com/#feat=template-literals - MedvedevDev
    • @MedvedevDev I check, but this time I could not have imagined that such a good thing as strings.lit. may not work in IE. - Frog Frogov
    • all new - poorly maintained and fit (well, or almost fit) - MedvedevDev
    • IE supports string literals; it does not support wildcards. This is not the same thing. - yar85
    • "And then a couple of days I changed everything into quotes" - and you could just put the babel - andreymal