I have an array containing the following data.
[ { name: 'hello', value: 'Bot hello!' },
{ name: 'help', value: 'Print help sheet.' },
{ name: 'kick', value: 'Kicks a user.' },
{ name: 'ping', value: 'Check the bot\'s Connection' },
{ name: 'roll', value: 'Roll a die.' } ]
var str = "ping"
if (str == //One of the names in the array){
//Do stuff
}
How can I create a function to check whether a string such as "ping" is equal to one of the values in the "name:" category? I want this to be dynamic so if the string is equal to "roll" it will flag that roll is in the array.