Describe your problem and how to reproduce it:
One of the test cases on the sidebar says dotProduct(...nVectors) should return 156000
. nVectors is undefined
Additionally, I notice that there are some tests where the text value doesn't match the actual test string.
Add a Link to the page with the problem:
https://www.freecodecamp.org/learn/coding-interview-prep/rosetta-code/vector-dot-product
Tell us about your browser and operating system:
The test in question:
- text: <code>dotProduct(...nVectors)</code> should return 156000.
testString: assert.equal(dotProduct([ 0, 1, 2, 3, 4 ], [ 0, 2, 4, 6, 8 ], [ 0, 3, 6, 9, 12 ], [ 0, 4, 8, 12, 16 ], [ 0, 5, 10, 15, 20 ]), 156000);
Looking at the file, there are a few tests where the text
value doesn't match the actual testString
. These should probably be fixed. At the same time, the function calls in the text
should be wrapped in <code>
tags or backticks (`
), I think.
Seems like an easy fix. So to be clear, we should do these to the tests:
I have a branch that addresses these issues, but there is a further issue with the solution as the dot product is only defined for pairs of vectors, and any test with an odd number of vectors should either fail (since dot products should return scalars) or return a vector (the scalar product of the first vectors times the last one probably; but a dot product function really should return a scalar).
The original vector product challenge at Rosetta Code actually calls for the computation of all four vector products. There is already a 'Dot Product' challenge separate from this one (it only uses two vectors for input) and a 'Vector Cross Product' which has similar problems to this issue.
So, which solution is best for the dot product in this issue (my vote is two vectors only, followed distantly by any number of pairs that I implemented)? Should I go ahead and fix 'Vector Cross Product' and add 'Vector Triple Product' and 'Scalar Triple Product' to complete the set in one PR or split them into separate issues/PRs or just ignore the other two completely since they can be computed with the dot and cross products?
@jeremyagray Just to point out, this issue is labelled _first timers only_. So, unless someone else is fine with removing that, I would not say 4 days is unreasonably long to expect an issue labelled _first timers only_ to be resolved, before opening it up.
nVectors product has no sense It should be two or triple vectors product. as original vector product challenge at Rosetta Code.
Most helpful comment
Seems like an easy fix. So to be clear, we should do these to the tests: