JavaScript issue

Hi, today I had an issue with Komodo, I don’t think it is necessary to report it as a bug, but I have tried to make a code that searches for a given word within a given text and reports the amount of times the word was found in the text, highlighting it in the page.
For some reasons everything was working perfectly within komodo (testing with it instead of the browser), but if I run the program on either chrome or opera it just finds the word once, even if it is written multiple times.
What’s wrong?
I am sure it is in my code, but I share it with you so that you can tell me if there is something wrong with Komodo and maybe helping me addressing the issue with my code as well :smiley: Thanks in advance

Hard to tell what’s going on here without having a full picture, try putting together a jsfiddle.

Note both Chrome and Opera use the same engine (webkit) whereas Komodo/Firefox use gecko, there are some differences between those engines that you may be running into.

A more appropriate place to ask this question would be, as the issue you’re dealing with is not related to Komodo.

Thanks, I have tried firefox as well and it worked nicely…
I’ll ask on stackoverflow as you recommended :smile:
I am a newbie with these things, it is my very very first independent piece of code :blush:

Btw, to avoid browser specific issues you could use something like jquery. Although it’s good to know how to do things in plain js and understand why jquery is relevant. A lot of devs these days learn jquery before they learn JS and the DOM, which is not doing them any favours.

1 Like

Yeah, jQuery is a very powerful and not so big so if you don’t care about 50KB of traffic - I recommend use it.

Hi, thanks for the hints :slight_smile: