-
Notifications
You must be signed in to change notification settings - Fork 501
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
Adding an example for String.slice() #1081
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @irenesmith !
Apart from the inline comments, it would be good to have some examples showing negative values, e.g.
console.log(str.slice(10, -5));
console.log(str.slice(-5));
console.log(str.slice(4,17)); // quick red fox | ||
</code> | ||
</pre> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove these trailing spaces, and the file should end with a return character.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -0,0 +1,7 @@ | |||
<pre> | |||
<code id="static-js">var str = 'The quick red fox jumped over the lazy dog\'s back.'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to have a blank line after this, for readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -0,0 +1,7 @@ | |||
<pre> | |||
<code id="static-js">var str = 'The quick red fox jumped over the lazy dog\'s back.'; | |||
console.log(str.slice(30)) // the lazy dog's back. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the standard expected output:
format, and a blank line between each example, like:
console.log(str.slice(30));
// expected output: "the lazy dog's back."
console.log(str.slice(4,17));
// expected output: ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also this line is missing the semicolon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed the missing semicolon and reformatted the comments.
I also added two new examples that show using negative numbers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
* upstream/master: Add window.ieConfig.origin for the target origin (mdn#1112) Improve example code (mdn#1111) Adding an example for the String.substring() method (mdn#1074) Adding an example for String.slice() (mdn#1081) Adding an example of String.split() (mdn#1071) Adding an example for the String.substr() method (mdn#1073) chore(deps): update dependency jest to v23.5.0 (mdn#1109) chore(deps): update dependency puppeteer to v1.7.0 (mdn#1108) Estelle/morestrings (mdn#1095) Added method for String[@@iterator]() (mdn#1069) Replace header image with a CC0 one (mdn#1100) chore(deps): update dependency prettier to v1.14.2 (mdn#1107) chore(deps): update dependency clean-css to v4.2.1 (mdn#1096) Update main element example to use cc0 image (mdn#1092) Update cc0 figcaption (mdn#1091) Fix meta.json for contenteditabl (mdn#1106)
No description provided.