A
A
Artem Gromakov2019-10-11 11:30:55
JavaScript
Artem Gromakov, 2019-10-11 11:30:55

What shortcomings can you tell about the code?

https://github.com/AntimatteryCreator/seawarship
This is my test task, I want to get criticism, I want to get a junior job on js. The company said it was weak. To my question "where is it weak?" and "what to pull up?", I got no answer. The turnaround time was 2-3 days. What I managed to write in 3 days I sent. I wrote everything myself. Dear people, who understands more, tell me, please, in which direction should I teach?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
X
xfg, 2019-10-11
@xfg

High cyclomatic complexity of such a code . Business logic is mixed into the DOM. Almost all code is duplicated.
This kind of code is hard to maintain. Difficult to read. Difficult to test. It's really weak. Yet we write for people, not for the computer. Writing complex code is very easy. Writing simple code is very difficult.

D
developer007, 2019-10-11
@developer007

It bothers me

let ships = {
'OneShip': 4,
'TwoShip': 3,
'ThreeShip': 2,
'FourShip': 1
};

I would decompose the method
function init(startgame) {
into small ones, because it is not clear what happens in such structures
naming small methods would be more obvious.
in general, work on naming and not write everything in a bunch.
maybe you got a CHSV reviewer and that's it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question