about | help | code help+videos | done | prefs |
firstXY
Return the index of the first occurrence of x or y in a string, or return -1 if the string does not contain an x or y. Hint: String objects have an indexOf() method that returns the first occurrence of one string within another, or -1 if the string can't be found. For example, if str is "mississippi", then str.indexOf("m") returns 0, str.indexOf("s") returns 2, and str.indexOf("q") returns -1. firstXY("box") → 2 firstXY("boxy") → 2 firstXY("yx") → 0 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 100
Copyright Nick Parlante 2017 - privacy