mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-19 21:09:51 +08:00
fix: use of otherwise (#57573)
This commit is contained in:
parent
d4df2d192a
commit
cfdc8a121a
@ -21,19 +21,19 @@ What is the return value for the `includes()` method?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
If the substring is found within the string, the method returns the string otherwise, it returns `undefined`.
|
||||
If the substring is found within the string, the method returns the string. Otherwise, it returns `undefined`.
|
||||
|
||||
---
|
||||
|
||||
If the substring is found within the string, the method returns `true` otherwise, it returns an empty string.
|
||||
If the substring is found within the string, the method returns `true`. Otherwise, it returns an empty string.
|
||||
|
||||
---
|
||||
|
||||
If the substring is found within the string, the method returns the string otherwise, it returns `null`.
|
||||
If the substring is found within the string, the method returns the string. Otherwise, it returns `null`.
|
||||
|
||||
#### --answer--
|
||||
|
||||
If the substring is found within the string, the method returns `true` otherwise, it returns `false`.
|
||||
If the substring is found within the string, the method returns `true`. Otherwise, it returns `false`.
|
||||
|
||||
### --question--
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@ console.log(char); // A
|
||||
## Other Common String Methods
|
||||
|
||||
- **The `indexOf` Method**: This method is used to search for a substring within a string. If the substring is found, `indexOf` returns the index (or position) of the first occurrence of that substring. If the substring is not found, `indexOf` returns -1, which indicates that the search was unsuccessful.
|
||||
- **The `includes()` Method**: This method is used to check if a string contains a specific substring. If the substring is found within the string, the method returns true otherwise, it returns false.
|
||||
- **The `includes()` Method**: This method is used to check if a string contains a specific substring. If the substring is found within the string, the method returns true. Otherwise, it returns false.
|
||||
- **The `slice()` Method**: This method extracts a portion of a string and returns a new string, without modifying the original string. It takes two parameters: the starting index and the optional ending index.
|
||||
- **The `toUpperCase()` Method**: This method converts all the characters to uppercase letters and returns a new string with all uppercase characters.
|
||||
- **The `toLowerCase()` Method**: This method converts all characters in a string to lowercase.
|
||||
|
||||
@ -262,7 +262,7 @@ console.log(char); // A
|
||||
## Other Common String Methods
|
||||
|
||||
- **The `indexOf` Method**: This method is used to search for a substring within a string. If the substring is found, `indexOf` returns the index (or position) of the first occurrence of that substring. If the substring is not found, `indexOf` returns -1, which indicates that the search was unsuccessful.
|
||||
- **The `includes()` Method**: This method is used to check if a string contains a specific substring. If the substring is found within the string, the method returns true otherwise, it returns false.
|
||||
- **The `includes()` Method**: This method is used to check if a string contains a specific substring. If the substring is found within the string, the method returns true. Otherwise, it returns false.
|
||||
- **The `slice()` Method**: This method extracts a portion of a string and returns a new string, without modifying the original string. It takes two parameters: the starting index and the optional ending index.
|
||||
- **The `toUpperCase()` Method**: This method converts all the characters to uppercase letters and returns a new string with all uppercase characters.
|
||||
- **The `toLowerCase()` Method**: This method converts all characters in a string to lowercase.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user