-
Notifications
You must be signed in to change notification settings - Fork 805
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
Tip #06 incorrect code for what it suggests #27
Comments
@Mattfxyz ping here! |
You're right Chris. This was the print every word in all uppercase.m. I incorrectly wrote the sample output. |
Consider
It is an ES5 feature: http://caniuse.com/#search=map |
I'd rather avoid passing an array of items. Let the function proceed the arguments as an array using the native 'slice': function printUpperCase(/* item1, item2, item n */) {
var elements = Array.prototype.slice.call(arguments);
//...
} printUpperCase('item1', 'item2'); //ITEM1, ITEM2 An array is an object; if you keep it local inside the function, the browser will garbage it as soon as the function exits. |
That only works with use strict, else we leak arguments. Roland notifications@github.com schrieb am Fr., 8. Jan. 2016 18:15:
|
Hey can we close this? |
Please submit changes in a PR and re-open this if you believe the tip is still not OK. |
Tip #6 suggests that it's code returns the first letter capital rather than the whole word.
printUpperCase("cactus");
// => Cactus
Ideally, if the end result wanted to look like that, the code should reflect something like this:
Just wanted to assist! Thanks!
-Chris
The text was updated successfully, but these errors were encountered: