How do I combine 2 javascript variables into a string

后端 未结 5 883
有刺的猬
有刺的猬 2020-12-03 03:40

I would like to join a js variable together with another to create another variable name... so it would be look like;

for (i=1;i<=2;i++){
    var marker =         


        
5条回答
  •  执笔经年
    2020-12-03 03:59

    warning! this does not work with links.

    var variable = 'variable', another = 'another';

    ['I would', 'like to'].join(' ') + ' a js ' + variable + ' together with ' + another + ' to create ' + [another, ...[variable].concat('name')].join(' ').concat('...');
    

提交回复
热议问题