Created
January 16, 2022 16:54
-
-
Save nickgrato/6c6ad40c96d15cb048a319307c99fb81 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const filterByColor = color => { | |
this.products.filter( product => { | |
let colorFound | |
// [0] index in this case is the 'color' options | |
const colors = product.options[0].values | |
if(colors.indexOf(color) != -1) colorFound = true | |
return colorFound | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment