This is a basic question in JavaScript. I tried a lot playing around this, but i can't the solution.
I have an array.
var keys = ["a", "b", "c"];
var array =[];
I am looping this keys to form another array
for (var i =0; i<keys.length; i++){
array[i]= "x" + keys[i];
}
If i print this array
i got ['xa'];
but what i needed is ["xa"]
only difference is the quotes ""
..
Why because i have to use this array in another json as with double quotes. Thanks in advance..
consider my json array name as final,
var query = {
"_source": {
"include": final
}.
NOw here the query is forming like
var query = {
"_source": {
"include": '["xa"]'
}
But i need:
var query = {
"_source": {
"include": ["xa"]
}