Retired
Sum with Arrows (retired)
3,717matt c
Loading description...
Fundamentals
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.
This KATA doesn't work! It sucks!
It says
retired
up there. That's why you can't submit your solution.Ooh, I didn't see
This comment has been hidden.
This KATA does not work! after passing the test, you will not be able to submit it. Эта КАТА не работает! после прохождения теста, ты не сможешь её засабмитить. p.s. приветики тебе если ты из RS School)
This kata was retired (it's in the kata's title), you can't submit, no matter how many times you try.
Please read the posts below before creating your own.
I wrote the above post as a warning to others)))))))))
сообщение выше я написал как предупреждение для остальных)))
It didn't work, see the post above.
Спаибо, друг Привет из RS))
I pushed a lots of time on 'ATTEMPT' button, it accepts successful and everything becomes charming green, however "SUBMIT" button doesn't appear. Everything is correct but can't submit it. Darn task
This kata was retired, you can't submit, no matter how many times you try.
Just leave it as string and you won't have 'TypeError: a.trim is not a function'
Нафига так усложнгять кату, которая тянет даже не на 8 а на 10kyu. Отстой питерский.
автор, ката просто отстой! Вот что это за дерьмо? 'TypeError: a.trim is not a function at fixFunc at /home/codewarrior/index.js:84:10 at /home/codewarrior/index.js:93:5 at Object.handleError '
Чтобы вся твоя жизнь вовращала непонятную ошибку
Very easy kata , like 8ku
This kata is absolute garbage!
TypeError: a.trim is not a function at fixFunc at /home/codewarrior/index.js:78:10 at /home/codewarrior/index.js:87:5 at Object.handleError
This comment has been hidden.
Can you share your code with a spoiler flag please? I have no problem with my solution in Javascript.
This comment has been hidden.
Your code passes the tests. You just need to have this part of the code
'sum = function... );}';
enclosed in quotes (like in the initial code set up).Thank you)
For solve kata: if you use brackets for function body, then you must add return. Unfortunately, without
return
, you will not pass test cases. Although areturn
is not required for an arrow function.It is explicitly stated in the description.
Probably I not correct understand phrase "the curly braces inside the reduce and the return statement".
One
"return"
is already present in the solution set up; you don't need to add more (the warning just means if you remove it and redefinesfunction...
as an arrow function without"return"
then it will not work. I don't know how to tell you more without spoiling too much of the solution. My opinion: if really you can't get it, it doesn't worth you spend too much time on this kata, it's a bit idiotic and you probably won't learn anything solving it.Thanks a lot for the explanation! This kata is a good test of knowledge of the arrow function syntax. My problem was that I added extra brackets to the body of the arrow function. Because of this, my arrow function always returned
undefined
. Now I have a better understanding of the arrow function syntax.This kata is a subject to deduplication process here: https://github.com/codewars/content-issues/issues/73 Please join the discussion to share your opinions, and help us identify duplicate kata and retire them.
Retired.
Thanks for the number 1.
Should be included in description.
This comment has been hidden.
This comment has been hidden.
Thank you so much!
This comment has been hidden.
This kata is actually a trash!
This comment has been hidden.
Sum
should contain a string representation of a function, instead of the function itself.Thank you, friend =)
Tests fail in a very bad way if returned value is not a string. Reason of a failure when someone returns something else than a string (like an actual function) should be stated clearly, and not just crash with a stack trace.
This comment has been hidden.
me too!
me too! Pls let me know
me too
Only bad katas force bad coding practices. This shouldn't have made it out of beta.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
Ahhh, I get it. It was my fault. Good kata.
This comment has been hidden.
This isn't a very good kata, considering this is probably the best solution...
...and it doesn't work. "But it's difficult." Sure. Parse harder. If the point is to use the fat arrow function, you have to let us use the actual fat arrow function, not the partial fat arrow function that's only passingly similar to a proper arrow function.
They are both proper fat arrow functions but since you're always right.. I'll Parse harder. And for the record your solution is wrong that wouldn't pass any tests..
What I've done is fixed the "But its difficult" issue by "Parsing harder"! Solutions with pure arrow functions should work now mark this issue as resolved also if you want to give "Parsing harder" a try I recommend this Kata Where you have to parse fat arrow functions :)
Yay, parsing harder!
For the record, my solution does work if you pull the ellipses. I got it from another kata I did where it was summing the args instead of an array.
This comment has been hidden.
This comment has been hidden.
Becuse it is explained in the solution how you should write your solution and I believe explained clearly I am going to Makr this issue as resolved! If you believe otherwise and have any recommendations about other ways without using eval then I would love to hear them! If you believe this issue is still a problem either comment on here with a detailed reason why or just create a new issue, Thanks! :)
BTW, codewars now runs all the code through babbel...
I know it does, but when you convert the code to a string it changes it to the old function so evaluating on a string is the only way to tell if someone uses an arrow function or not... If you don't agree try it yourself otherwise could you please mark this suggestion as resolved? thanks :)
@matt c: Maybe you want to take part in this discussion.
Thank you, I will look at that. @bojidar-bg if there is nothing else, could you please mark this suggestion as resolved, Thanks :)
ok..
This comment has been hidden.
It seems you may be using the old version of the code, if you click reset or change your start code to...
var Sum = 'sum = (function(arr){ return arr.reduce( => { return }); })';
It should work, thank you. Mark as resolved if this works for you?Unfortunately it doesn't help. Test passes but I get error when trying to submit.
Could you post your solution and mark it as a spoiler so I can see for myself what is happening?
Any code gives an error when sumbmitting so I don't think there's an issue there. Even
var Sum = function(arr){ console.log("whatever"); };
TypeError: Object function Sum(arr) { console.log('whatever'); } has no method 'indexOf' at fixFunc
You can see my original solution in the first post, it's in error description.
Sum is supposed to be a string with code in it so your soluton should atleast be
var Sum = "function(arr){ console.log("whatever"); };
If this solves your problem please mark this issue as resolved, thank you.You're right. I'm an idiot.
Good idea. I feel we really need ES6 support on CodeWars directly (through Babel or something) so that more Kata like this can be created without the hacky conversion.
Freeze
Math.random
. Otherwise it's still possible to cheat.Sorry for the trouble, I have frozen it now, anymore suggestions?
Thank you for your suggestion
The number of tests is too small. One can easily solve this kata with trial and error. Random tests would help.
Retest....
Duplicate of http://www.codewars.com/kata/532b4057484b0e58e8000766, as long as the use of arrows isn't enforced in the tests. Also, no random test cases and corner cases.
You can't test for arrow functions because the toString converts it to the normal Function....
And yet you didn't address any of the other issues. Also, if it isn't testible, then your kata is a duplicate. Easy as that. I was able to copy my solution from the other kata. If every solution of the other kata is a valid solution to this, what does that make your kata?
Correct. A duplicate.
Did you downvote all my comments on this kata methodically, just because I pointed out that it's a duplicate?
You actually can test for arrows, but that will require modification of the kata. You can ask to provide not a function, but a string which can be evaluated to the function, and:
This comment has been hidden.
There is a pretty same problem http://www.codewars.com/kata/532b4057484b0e58e8000766 And please add few more test cases.
This comment has been hidden.