I have an array of many objects like the following
let arrayProductos = [
{"producto": "90060181", "cuotas": "2"},
{"producto": "90160763", "cuotas": "6"},
{"producto": "93650002", "cuotas": "3"},
{"producto": "33350088", "cuotas": "12"},
]
and on the other hand I have a variableproductoEjemplo=93650002
How can I do to obtain the quotas productoEjemplo
without the need to go through it with a for
?
You can use
Array.prototype.filter
, this method returns all the elements of an array that meet a specific criteria