Saturday, 27 May 2017

Node.js String concatenation

I tryed to concatenate a CREAT string for MYSQL in Javascript (Node.js).

        var tabellenName = 'CREATE TABLE test (\n';
        for(var i = 0; i < kopf.length-1; i++){
            tabellenName += '`'+kopf[i] + '` VARCHAR(255),\n';
        }
        tabellenName += '`'+kopf[kopf.length-1];
        console.log(tabellenName);
        console.log("\n-------------------------------------------\n");
        tabellenName += '` VARCHAR(255)\n';
        console.log(tabellenName);
        console.log("\n-------------------------------------------\n");
        kopf[kopf.length-1] += '` VARCHAR(255),\n';
        console.log(kopf[kopf.length-1]);

But i get the following strings in console: Console log

is there any way to get: "`Kennung-Besonderer-Fall-Modellvorhaben` VARCHAR(255)" in the last line?



via Stomson

No comments:

Post a Comment