Invalid assignment left-hand side, javascript

前端 未结 6 1668
清酒与你
清酒与你 2021-01-15 16:33

I am sure I am doing something silly here:

var addhtml = \'
\' += \'
e[\"screen_name]&
6条回答
  •  旧巷少年郎
    2021-01-15 16:45

    The assignment (=) is not necessary, you can just use +. There are two other ways to construct multiline strings:

    // method 1: use continuation \
     var addhtml = '\
            
    \
    e["screen_name]
    \
    \
    e["description"]
    \
    '; //method 2: use an array and join the elements var addhtml = [ '
    ', '
    e["screen_name]
    ', '
    ', '
    e["description"]
    ', '
    ' ].join('');

提交回复
热议问题