Ad
Code
Diff
  • var generateComment = function (array){
        var z;
        var k = [];
        for (var i = 0; i < array.length; i++) {
            z = Math.floor(Math.random() * array[i].length);
            if (array[i][z][array.length - 1] == ',') {
            k.push(array[i][z]);
            } else {
            k.push(array[i][z] + ' ');
            }
        };
        return k.join('');
    };
    //console.log(generateComment([['hi,', 'hello,', 'hey,'], ['how are'], ['you', 'ya'], ['doing', 'going'], ['?', '?!', '']]));
    • var generateComment = function (array){
    • var z;
    • var k = [];
    • for (var i = 0; i < array.length; i++) {
    • z = Math.floor(Math.random() * array[i].length);
    • k.push( array[i][z]);
    • if (array[i][z][array.length - 1] == ',') {
    • k.push(array[i][z]);
    • } else {
    • k.push(array[i][z] + ' ');
    • }
    • };
    • return k.join(' ');
    • return k.join('');
    • };
    • generateComment([['hi,', 'hello,', 'hey,'], ['how are'], ['you', 'ya'], ['doing', 'going'], ['?', '?!', '']]);
    • //console.log(generateComment([['hi,', 'hello,', 'hey,'], ['how are'], ['you', 'ya'], ['doing', 'going'], ['?', '?!', '']]));
Code
Diff
  • var generateComment = function (array){
        var z;
        var k = [];
        for (var i = 0; i < array.length; i++) {
            z = Math.floor(Math.random() * array[i].length);
            k.push( array[i][z]);
        };
        return k.join(' ');
    }
    console.log(generateComment([['hi,', 'hello,', 'hey,'], ['how are'], ['you', 'ya'], ['doing', 'going'], ['?','?!', '']]));
    • var generateComment = function (array){
    • var z;
    • var k = [];
    • for (var i = 0; i < array.length; i++) {
    • z = Math.floor(Math.random() * array[i].length);
    • k.push( array[i][z]);
    • };
    • return k.join(' ');
    • };
    • generateComment([['hi,', 'hello,', 'hey,'], ['how are'], ['you', 'ya'], ['doing', 'going'], ['?', '?!', '']]);
    • }
    • console.log(generateComment([['hi,', 'hello,', 'hey,'], ['how are'], ['you', 'ya'], ['doing', 'going'], ['?','?!', '']]));
Code
Diff
  • var generateComment = function (array){
        var z;
        var k = [];
        for (var i = 0; i < array.length; i++) {
            z = Math.floor(Math.random() * array[i].length);
            k.push( array[i][z]);
        };
        return k.join(' ');
    };
    generateComment([['hi,', 'hello,', 'hey,'], ['how are'], ['you', 'ya'], ['doing', 'going'], ['?', '?!', '']]);
    • var generateComment = function (array){
    • }
    • var z;
    • var k = [];
    • for (var i = 0; i < array.length; i++) {
    • z = Math.floor(Math.random() * array[i].length);
    • k.push( array[i][z]);
    • };
    • return k.join(' ');
    • };
    • generateComment([['hi,', 'hello,', 'hey,'], ['how are'], ['you', 'ya'], ['doing', 'going'], ['?', '?!', '']]);