8 kyu

Training JS #31: methods of arrayObject---isArray() indexOf() and toString()

Description
Loading description...
Fundamentals
Tutorials
View
AllIssues2Questions2Suggestions2Show Resolved
  • Please sign in or sign up to leave a comment.
  • katarzynabogumil Avatar

    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.

  • Shema Avatar

    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.

  • farhanaditya Avatar

    The task desc is kinda misleading.

    If arr contains neither 5 nor 13, function should return:

    "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'".

  • user4896126 Avatar

    verbose description, just get to the point...

  • Puck Avatar

    Somebody has given you the wrong suggestion.

    If arr contains neither 5 nor 13

    is equal to !arr.includes(5) && !arr.includes(13).

    It should be If arr contains either no 5 or no 13

  • ottotsuma Avatar

    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?

  • Joolius91 Avatar

    This comment has been hidden.

  • Medvean Avatar

    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?

  • robjar Avatar

    The description concerning white array case is incorrect.

    • myjinxin2015 Avatar

      I don't understand, why it is incorrect? can you explain?

    • myjinxin2015 Avatar

      dear robjar,

      Please explain your problem in detail, thank you!

    • robjar Avatar

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

    • myjinxin2015 Avatar

      ok, I'v fixed it. Thank you ~~

      Issue marked resolved by myjinxin2015 9 years ago
    • robjar Avatar

      Thank you!

    • dinglemouse Avatar

      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"

    • myjinxin2015 Avatar

      Changed. Cheers O_o

    • jHoller Avatar

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

    • Codemon72 Avatar

      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""