I have the following code:
let filters = []
this.query.split(" ").forEach(function(word){
// ...
filters.push(value)
}
this.push('filters', DOUBT);
In Polymer, I can do this.push('filters', value1, value2, value3)
in order to push three values to an array property at the same time. The problem is that I don't know how many words the user query would be composed by.
I can't do this.push('filters', value)
for each word of my query because my filters
property has an observer and I don't want the function to be launched multiple times. Finally, I neither can do this.push('filters', filters)
since this will save an array inside an array.
Is there any function in JavaScript which unpacks an array and gives all its elements? I'm looking for something similar to this.push('filters', filters*)