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

Adding an example for String.slice() #1081

Merged
merged 7 commits into from
Aug 15, 2018
Merged

Adding an example for String.slice() #1081

merged 7 commits into from
Aug 15, 2018

Conversation

irenesmith
Copy link
Contributor

No description provided.

@wbamberg wbamberg self-requested a review August 4, 2018 04:37
Copy link
Contributor

@wbamberg wbamberg left a 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>

Copy link
Contributor

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.

Copy link
Contributor Author

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.';
Copy link
Contributor

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.

Copy link
Contributor Author

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.
Copy link
Contributor

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: ...

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@irenesmith
Copy link
Contributor Author

I also added two new examples that show using negative numbers.

Copy link
Contributor

@wbamberg wbamberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@wbamberg wbamberg merged commit 3a72c81 into mdn:master Aug 15, 2018
wbamberg pushed a commit to wbamberg/interactive-examples that referenced this pull request Aug 31, 2018
* 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)
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.

None yet

2 participants