How to target a specific word in a javascript array of strings

Hi all, I’m certain this is possible, i just cant seem to find the answer anywhere, How do you target a specific word in an array of strings? I have found various examples for how to target a word in a string, but i am not using a string, I am using an array of strings.

this is my array:

var sec = ["10% bonus on your next order! Use " + “KEYCODE: TEN”, "15% bonus on your next order! Use " + “KEYCODE: FIFTEEN”,
"Free Shipping bonus on your next order! Use " + “KEYCODE: FREE SHIPPING”, "10% bonus on your next order! Use " + “KEYCODE: TEN”, "25% bonus on your next order! Use " + “KEYCODE: TWENTY-FIVE”, "Free Shipping bonus on your next order! Use " + “KEYCODE: FREE SHIPPING”];

I want to be able to find (target) a particular word in the array ( say KEYCODE for sake of example), and
then create a var and an html() method that outputs that word as a separate answer.

I know how to write the var and .html() method, what I am unfamiliar with is how to write the codebase that can find the particular word (in this case KEYCODE) in my array of strings.

I could be over thinking it and maybe it is possible to use the various javascript/JQuery string examples?

Thanks in advance for any help or lead

Have you tried modifying the code from the earlier topic?

In truth, no. That question was in relation to being able to target a specific word and wrap a span tag around it, since i figured out how to add the span into the array, i didn’t really take a closer look at the example from coothead. But I will go back and have another look and see if I can modify the example to suit my new need.

Thank you

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.