i'm a beginner in javascript, i apologize in advance for my question if you will find it a little weird or to easy.
Here's my problem for example:
var category = ["orange","lemon","apple","banana"];
var myUrl = "www.website.com/products/15/lemon/image1.png";
When my user will click on an image, i will get a new fruit value for example the string "apple".
var changeCategory = "apple";
What is the more efficient way to check if the word of one of my fruits is in the url and replace it by the new value... or if the new value is actually in myUrl variable to do nothing?