You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
452 B
JavaScript
24 lines
452 B
JavaScript
//Searchig in an array of objects
|
|
var expenses = [{
|
|
type :"Education",
|
|
amount : 2000,
|
|
}, {
|
|
type:"Eating Out",
|
|
amount : 600,
|
|
}, {
|
|
type: "Entertainment",
|
|
amount : 500,
|
|
}];
|
|
|
|
|
|
console.log(expenses[1]);
|
|
console.log(expenses[2].amount);
|
|
|
|
const fnSearch = expenses.findIndex(function(item, index){
|
|
console.log(item);
|
|
console.log(index);
|
|
//return item.type === "Eating Out";
|
|
});
|
|
//fnSearch = 3;
|
|
//console.log(fnSearch);
|