@
@
@Richswitch2017-06-11 11:41:32
JavaScript
@Richswitch, 2017-06-11 11:41:32

How to add an empty line before each line in an array?

How can I add an empty string before each string in an array, but without resorting to adding a space before a character in the string itself?

var arr = ['Hi', 'my', 'name', 'is'];
var counter = '';
    arr.push('John');
    arr.forEach(function(elem){
      counter += elem;
    });
    

    console.log(counter);

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Pushkarev, 2018-10-17
@AXP-dev

There are 2 ways here.
1) Hack through the input radio (this is if you really don’t want to use JS)
2) Write a small JS script. Here is an article for you - https://medium.freecodecamp.org/how-to-manipulate-... everything is signed there. There is even a ready-made code

P
Pavel Voronyuk, 2018-10-17
@pawlek

Can the .active class be added to a div with the class .items-list-item-colors ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question