Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSS-110 Implement charAt and charCodeAt for the String prototype #107

Conversation

PrestonLTaylor
Copy link
Owner

Example Code:

var obj = new String("abc");

// charAt
"abc".charAt(0); // Returns "a"
"abc".charAt(-1); // Returns ""

obj.charAt(0); // Returns "a"
obj.charAt(-1); // Returns ""

// charCodeAt
"abc".charCodeAt(0); // Returns 97
"abc".chatCodeAt(-1); // Returns NaN

obj.charCodeAt(0); // Returns 97
obj.chatCodeAt(-1); // Returns NaN

Example Code:
```js
"abc".charAt(0); // Returns "a"
"abc".charAt(-1); // Returns ""

var obj = new String("abc");
obj.charAt(0); // Returns "a"
obj.charAt(-1); // Returns ""
```
Example Code:
```js
"abc".charCodeAt(0); // Returns 97
"abc".chatCodeAt(-1); // Returns NaN

var obj = new String("abc");
obj.charCodeAt(0); // Returns 97
obj.chatCodeAt(-1); // Returns NaN
```
@PrestonLTaylor PrestonLTaylor merged commit 0de507d into master Jun 4, 2024
3 checks passed
@PrestonLTaylor PrestonLTaylor deleted the JSS-110-Implement-charAt-and-charCodeAt-for-the-string-prototype branch June 4, 2024 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant