const data = [
{
id: "1",
name: "Apple iPhone 5c",
memory: "16GB, 32GB and RAM 1 GB"
},
{
id: "2",
name: "Apple iPhone 6",
memory: "16GB, 32GB and RAM 1 GB"
},
{
id: "3",
name: "Lenovo A6000",
memory: "16GB, 32GB and RAM 1 GB"
}
]
le
[
{
id: "3",
name: "Lenovo A6000",
memory: "16GB, 32GB and RAM 1 GB"
}
]
const lowered = str.toLowerCase();
const filtered = data.filter(n => !n.name.toLowerCase().indexOf(lowered));
const filtered = data.filter(function(n) {
return n.name.toLowerCase().startsWith(this);
}, str.toLowerCase());
const filtered = data.filter(((reg, n) => reg.test(n.name)).bind(null, RegExp(`^${str}`, 'i')));
mySearch(arr,search)