From aa433935d8d514bdfe5f93d3c23ac75409dddcf3 Mon Sep 17 00:00:00 2001 From: Fredrick Mgbeoma Date: Sun, 3 Sep 2017 09:57:26 +0100 Subject: [PATCH] updated article.md Fixed typos --- 1-js/05-data-types/03-string/article.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/1-js/05-data-types/03-string/article.md b/1-js/05-data-types/03-string/article.md index c7d889e9..642edb63 100644 --- a/1-js/05-data-types/03-string/article.md +++ b/1-js/05-data-types/03-string/article.md @@ -236,7 +236,7 @@ alert( str.indexOf("id") ); // 1, "id" is found at the position 1 (..idget with The optional second parameter allows to search starting from the given position. -For instance, the first occurence of `"id"` is at the position `1`. To look for the next occurence, let's start the search from the position `2`: +For instance, the first occurrence of `"id"` is at the position `1`. To look for the next occurrence, let's start the search from the position `2`: ```js run let str = 'Widget with id'; @@ -245,7 +245,7 @@ alert( str.indexOf('id', 2) ) // 12 ``` -If we're interested in all occurences, we can run `indexOf` in a loop. Every new call is made with the position after the previous match: +If we're interested in all occurrences, we can run `indexOf` in a loop. Every new call is made with the position after the previous match: ```js run @@ -295,7 +295,7 @@ if (str.indexOf("Widget")) { The `alert` in the example above doesn't show, because `str.indexOf("Widget")` returns `0` (meaning that it found the match at the starting position). Right, but `if` considers that to be `false`. -So, we should actualy check for `-1`, like that: +So, we should actually check for `-1`, like that: ```js run let str = "Widget with id";