Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Not a kata issue. Your code does not throw an Exception when
query
is not an array of ObjectYour code does not throw an error / exception when any of the given inner array of the 2-dimensional array is not of length 2. One of such cases being:
This is the design of the kata, there is only 1 exception to throw though, and the conditions of each are specified. This is a much better kata design than a lot of those which prompt users to
return -1
/return "invalid string"
as returning multiple types is bad practice.The only thing that one might be nitpicking is different condition should throw different Exceptions for debugging purposes . But since this is not a production-based coding foundation, I do not see much of an issue :-)
This comment is hidden because it contains spoiler information about the solution
Easy and cool Kata, BUT WHY SO MANY EXCEPTIONS??????? Are you kiding me??????
Query length should not be less than or greater than 2. If it is, throw error.
This comment is hidden because it contains spoiler information about the solution
Добрый день!
Условия у данной Ката не отражают суть задачи.
Поэтому решил написать данное пояснение, возможно кому-то поможет не ломать голову.
У вас есть гипотенуза и катет в прямоугольном треугольнике.
readings - содержит 4ре значения.
const [[distance1, time1], [distance2, time2]] = readings;
Есть два подхода, чтобы учесть данное условие:
Обратите внимание, что ваш код должен быть способен обрабатывать показания, передаваемые в функцию в любом порядке.
Можно вернуть модуль числа при расчетах или просто изменить порядок элементов массива (distance1 > distance2)
На всякий случай формула прямоугольного треугольника: (A2 + B2 === C**2) (A/B - катеты) (C - гипотенуза)
Только нужно не забывать, что нам нужно относительное значение и в километрах в час.
Good day!
The conditions of this Kata do not reflect the essence of the problem.
Therefore, I decided to write this explanation, perhaps someone will help not to break his head.
You have a hypotenuse and a cathetus in a right triangle.
readings - contains 4 values.
const [[distance1, time1], [distance2, time2]] = readings;
There are two approaches to account for this condition:
Note that your code must be able to handle readings passed to the function in any order.
You can return the modulus of the number in the calculation, or you can simply change the order of the array elements (distance1 > distance2)
Just in case, the formula for a right triangle: (A2 + B2 === C**2) (A/B - cathetes) (C - hypotenuse).
Only we need to remember that we need a relative value and in kilometers per hour.
P.S. please explain in the problem that you have an angle to the road of 90 degrees (For est and act this is a very good explanation).
Solved...
I seem to be getting funny errors despite having solved this questions, any tips please?
Hello, I'm stuck on the solution of this Kata.
Basically I've solved, just I don't understand what kind of error this Kata expects from:
I used // throw new Error(""); but it seems to not be the solution expected by the author so any tips/ suggestion would be helpful
cheers
This comment is hidden because it contains spoiler information about the solution
Awesome Kata! Thanks!
Done
Loading more items...