Closed sandcha closed 7 years ago
If I type salaire base
, I get results I should not have:
Sorry I had to rewrite some of the code , but the demo is coming 😱 .
As I can't review what is not here anymore, some feedback:
In JS
, as in duck-typed languages in general, you are quite flexibles on types. For instance 1 + true == 2
. So counter += condition ? 1 : 0
can be easily replaced by counter += condition
.
When you want to iterate on the items of an array, the fancy and brand new for (const item of array) {
is nicer than for (const item in array) {
. The latter will iterate on the indexes i
, and you then have to get the value with array[i]
, which is very heavy. If you can't use ES6
on another project, array.forEach(...)
is still a better alternative than iterating on indexes.
In general, it's more readable to avoid working with the indexes, unless you really have to (and you rarely have).
Otherwise, storing the scores as properties was really clever, and the sorting was well done 👍 .
I'm not able to review this, as I edited the code. @MattiSG do you have time ? Other @sandcha or @Anna-Livia ?
@fpagnoux Ok with your code changes as well.
Ok, rebasing and merging 🚀
Connected to #84
Manage multiple words search. First words have more importance than next ones. Multiple matching in name has priority. And it looks for matching in name and in description but doesn't look for word repetition in name and in description.