I have a list of values in a array, I need to create a query based on that
var x = [1, 2, 3, 4, 5];
url = http://localhost:3000/site/query=("ID:"+ 1 + "ID:" + 2 + "ID:" + 3)
the number of ID increases based on values in an array.
I tried creating a for loop and than add i for example:
for (var i = 0; i < x.length; i++) {
if (i === 0) {
url = http://localhost:3000/site/query=("ID:"+ x[i])
}
if (i === 1) {
url = http://localhost:3000/site/query=("ID:"+ x[0] + "ID:" + x[i])
}
}
I cannot create multiple if blocks because the "i"value can be dynamic and there could be many values in array
ID:ID:ID:ID:without a separator character?ID:1ID:2?