When I run this in node, I get: "TypeError: cc.slice is not a function"
All I added was "console.log(maskify(1234567890123456)"
Anyone know what's wrong?
Edit: I didn't pass the numbers as a string, that fixed it!
There are different types of training. A "kata" is an individual technique that can be practiced independently of other techniques. The goal of practicing an individual kata is to internalize a specific technique until it becomes reflexive. Then, many katas (techniques) can be composed together to solve real problems.
In the case of coding, "validation" is a specific technique, and can be practiced independently of other techniques. There's no reason to practice validation when the thing you want to practice is actually array manipulation.
@Azuaron, I do not agree. This is for training purposes, right? You should practise validating your code as part of this (as it is best practice).
I agree, this is clever, but in no way is this the best practice:
This is my opinion, what do you guys think?
Edit: There is already an answer to this in one of the other comment by @Grey. Refer that for an awesome detailed explanation.
Infinity is passed as the initialValue to the 'reduce' function, i.e. it will be the value of 'val' for the very first iteration. There it is used to find the minimum value as Math.min(..., Infinity), which will always give the result as the first argument of Math.min function. eg. Math.min(100, Infinity) = 100, literally everything is less than Infinity.
How I do it is I set a time limit to solve a Kata. If I really can't see a solution within the time limit, I google how to solve the problem. Then I get the tests to pass, submit and compare my solution with others. I then save examples of anything I have learned to repl.it - I then have a toolbox of solutions to refer to (no Kata spoilers saved here I might add!) I also make sure that I understand how any new features or builtin functions of the language I've learned work. I don't rush to complete Kata, I try to take my time, I usually only do one a day, and spend about an hour a day in total on all of the above work I have described. I've already levelled up from 8 to 6 and that's in less than 2 months. Little by little. My goal is to become a code wars Sensei and level up to the extent that I can help others.
What is the use of Infinity in this code? Please someone explain me, i dont get it :(
relax man, just get enough practice and you will remember methods and what they are do
Why do you calculate the lcm when you can just swap the values and divide by the gcd? Am I missing something?
Do you have any tips to get better at solving these problems because I just recently finished a tutorial and it is not really helping me to solve these questions?
This comment is hidden because it contains spoiler information about the solution
Check my code, how can I improve
I couldn't found the "Best practices".