8 kyu
Training JS #31: methods of arrayObject---isArray() indexOf() and toString()
3,549myjinxin2015
Loading description...
Fundamentals
Tutorials
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Hey, there is a mistake in the description:
If arr contains neither 5 nor 13, function should return:
"It's a white array"
Examples
blackAndWhite([5,12]) should return "It's a white array"
it should be:
If arr contains EITHER 5 OR 13, function should return:
"It's a white array"
I know it came from the comments, but neither/ nor means that the arr.indexOf(5) and arr.indexOf(13) both are -1, which is not the case in the example.
Yes. The description has not been changed yet ..
I hope the author's English has improved over the last couple of years. These kata's descriptions are not beginner-friendly and leave a lot to be desired.
The task desc is kinda misleading.
"neither 5 nor 13" means both 5 and 13 (negatively). In other words, it's saying that "if the arr does not contain both 5 and 13. ..."
I'd suggest change it to "if arr only contains one or none of them", or just remove it and say "otherwise, return 'It's a white box'".
verbose description, just get to the point...
Somebody has given you the wrong suggestion.
is equal to
!arr.includes(5) && !arr.includes(13)
.It should be
If arr contains either no 5 or no 13
Expected: ''It\'s a white array'', instead got: ''It\'s a black array'' Log Test for: arr=[13,0,1,11,10,3,5,4,16]
But it contains both 5 and 13? is that not a black array?
yeah, that's a black array, you're just probably reading the logs off by one
This comment has been hidden.
This comment has been hidden.
Need help again.
Training JS #31: Expected: It's a fake array, instead got: undefined
My solution https://repl.it/CVzL What isn't correct?
Sorry, I can't open the URL, please paste your code here and mark as having spoiler content.
The description concerning white array case is incorrect.
I don't understand, why it is incorrect? can you explain?
dear robjar,
Please explain your problem in detail, thank you!
Hi myjinxin2015,
Sorry for delay! In my opinion instead of "If arr does not contain both 5 and 13, we should return" should be "If arr does not contain 5 or 13, we should return".
ok, I'v fixed it. Thank you ~~
Thank you!
Hi @myjinxin - that still seemed ambiguous to me...
Better to say
If arr contains neither 5 nor 13, we should return "It's a white array"
Changed. Cheers O_o
I believe this is still should be worded better.
Saying "If arr contains neither 5 nor 13" implies you're looking for the case where there is no 5, as well as no 13 (both have to not exist). What the white array is really testing for is a case where there is either no 5 or no 13 (only one of those does not exist).
Perhaps you could say "If arr either does not contain 5, or it does not contain 13, we should return "It's a white array".
I also got stuck on the incorrect wording. I think correct would be simply: "If arr does not contain 5 and 13, function should return: "It's a white array""