Link to home
Start Free TrialLog in
Avatar of steinchen84
steinchen84

asked on

JavaScript and startsWith()

I need to check if a string starts with the word "page" in the javascript section of a jsp-file. Depending on the number of page the user is browsing, it'll be "page 1", "page 2" and so on. So I need to compare the static part of the string, which is "page".
Do I need to use regular expressions for this?

The method String.startsWith() is not working with javascript, or am I wrong in this point?
Thanks for any help.
ASKER CERTIFIED SOLUTION
Avatar of HonorGod
HonorGod
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of steinchen84
steinchen84

ASKER

Thank you - both solutions worked fine.
No worries - glad to help.
Glad to be of some assistance.  Thanks for the grade & points.

Good luck & have a great day