how can i find a special character like ” or ‘?’ in an objects array in javascript?

Specific to your use case this is how you would get all the usernames that contain those characters.

Array.filter creates a new array so you dont have to mutate the original one to get the values you want.

array.filter(obj => obj.username.includes("!") || obj.username.includes("?"))

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top