For example :
var arr = ["accounts","accountable","address","abandon","ahead"];
Suppose,I want to search for words starting with 'acc' and add those words to another array.
I tried using startsWith() but its not working.
Try this
var arr = ["accounts","accountable","address","abandon","ahead"];
const result = arr.filter(word => word.startsWith('acc'));
var array1 = ['a', 'b', 'c'];
console.log(array1.concat(result));
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |