I am querying dexie database with startsWithIgnoreCase and push result in an array but while printing or using it, it is throwing an error as undefined
I have tried using JSON.stringify, toString, String to convert it in a string and print on console but still it showing undefined
While print whole array to console showing normal Array()
arr = [];
db.table('friends').where('name').startsWithIgnoreCase('DoB/')
.each(function (friend) {
arr.push(String(friend.name));
});
console.log(arr[0]); //undefined
console.log(arr); //Array() with correct element inside
I should at least print something when i use console.log(arr[0])