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 of String.split() #1071

Merged
merged 7 commits into from
Aug 14, 2018
Merged

Adding an example of String.split() #1071

merged 7 commits into from
Aug 14, 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! This has similar issues in the PR to #1070, and some style guide issues.

@@ -1,5 +1,19 @@
{
"pages": {
"stringIterator": {
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like this PR has the same issues with meta.json as #1070.

@@ -0,0 +1,8 @@
<pre>
Copy link
Contributor

Choose a reason for hiding this comment

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

Again this and string-iterator.html should not be included.

@@ -0,0 +1,7 @@
<pre>
<code id="static-js">const str = "The quick brown fox jumped over the lazy dog.";
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 single quotes for strings.

Copy link
Contributor

Choose a reason for hiding this comment

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

Since split() is not ES6, please don't use ES6 constructs like const: https://github.com/mdn/interactive-examples/blob/master/JS-Example-Style-Guide.md#language-choice-es5es6.

<code id="static-js">const str = "The quick brown fox jumped over the lazy dog.";

words = str.split(" ");
console.log(words[3]); // fox
Copy link
Contributor

Choose a reason for hiding this comment

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

<pre>
<code id="static-js">const str = "The quick brown fox jumped over the lazy dog.";

words = str.split(" ");
Copy link
Contributor

Choose a reason for hiding this comment

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


words = str.split(" ");
console.log(words[3]); // fox
</code>
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be good to show a couple of other examples of the syntax, e.g.

var result2 = str.split("");
console.log(result2[0]);

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 for cleaning up the PR! But this doesn't seem to have addressed all the comments on the example itself.

@irenesmith
Copy link
Contributor Author

Added two more examples and made sure that the expected output format for comments was used.

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 great, just a couple of formatting nits, but I've fixed those.

@wbamberg wbamberg merged commit 6a3f02c into mdn:master Aug 14, 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants