Skip to content

[Finishes #106352136] String contains#4784

Merged
Bjvanminnen merged 4 commits into
stagingfrom
stringContains
Oct 26, 2015
Merged

[Finishes #106352136] String contains#4784
Bjvanminnen merged 4 commits into
stagingfrom
stringContains

Conversation

@Bjvanminnen

Copy link
Copy Markdown
Contributor

Add String.prototype.contains to applab

Add some tests for this and our other string functions

Comment thread apps/src/applab/dropletConfig.js Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Note, most of these changes are getting rid of quotes around modeOptionName

@davidsbailey

Copy link
Copy Markdown
Member

This seems like a pretty big departure from our strategy up to this point, which was to only expose methods on classes which actually have that method in Javascript (ES5). Can you give me some background on this decision?

@Bjvanminnen

Copy link
Copy Markdown
Contributor Author

I agree, and expressed my apprehensiveness about monkey patching String.prototype.

Basically, the ed team thinks that teaching indexOf() !== -1 right away is more confusing than they would like. I suggested possibly doing something like contains(string, substring), but that's also weird since we do have a bunch of other methods on String.prototype that we teach.

After discussing some we Sarah, we decided that the benefits (easier for students) outweighed the fact that we're now teaching stuff that won't work in native JS. If you feel strongly about this, you can try to convince her otherwise :)

@Bjvanminnen

Copy link
Copy Markdown
Contributor Author

Will update to use String.prototype.includes instead https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes

@Bjvanminnen

Copy link
Copy Markdown
Contributor Author

@davidsbailey could you take a look now that we're using includes?

@davidsbailey

Copy link
Copy Markdown
Member

LGTM

Bjvanminnen added a commit that referenced this pull request Oct 26, 2015
[Finishes #106352136] String contains
@Bjvanminnen Bjvanminnen merged commit e2a75a9 into staging Oct 26, 2015
deploy-code-org added a commit that referenced this pull request Oct 26, 2015
684613a Merge pull request #4790 from code-dot-org/droplet-update-20151023 (Josh Lory)
23d377c Merge branch 'staging' into droplet-update-20151023 (Josh Lory)
e2a75a9 Merge pull request #4784 from code-dot-org/stringContains (Bjvanminnen)
@Bjvanminnen Bjvanminnen deleted the stringContains branch November 3, 2015 20:56
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.

2 participants