Skip to content

Commit 1df1e0e

Browse files
Swapping indexOf to includes in comparisons (#1885)
This proposal is to remove the usage of the `indexOf` method when testing for the presence of a given character in a string. While `indexOf` is compatible with IE, `includes` is friendlier to newer JavaScript developers and it improves code readability.
1 parent 8c96d8f commit 1df1e0e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/guide/essentials/watchers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default {
1919
watch: {
2020
// whenever question changes, this function will run
2121
question(newQuestion, oldQuestion) {
22-
if (newQuestion.indexOf('?') > -1) {
22+
if (newQuestion.includes('?')) {
2323
this.getAnswer()
2424
}
2525
}

0 commit comments

Comments
 (0)