Generate string from an array?

Example I have an array

all_object = ['A', 'B', 'C']

and I want to create a string from this array is

"stringANDstringANDstring"

if all_object = ['A', 'B', 'C','D']

it will become

"stringANDstringANDstringANDstring"

may I know how does I archive this?

There is no A or B or C in result? Only string AND string? I think you are looking how to join array elements
See this to find how to ... Array.prototype.join() - JavaScript | MDN

Ohh fully understood right now! thanks you very much!
I loop first

    for (i = 0; i < all_object.length; i++) {
        newObject.push(textString);
    }

newObject= newObject.join("AND");

and everything done!

You don't need the loop, just
`newObject= all_object.join("AND")

That will not affect all_object

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.