Hot answers tagged

3

First off, congrats on getting your navbar working and sticking with this over several days! 🎉🥂 There are a lot of things which could be improved, but at a glance the most glaring issue is that your styles are spread all across the HTML, CSS, and JS files. This makes it very difficult to reason about them. Here's how you could simplify the situation and ...


2

Use DOM not markup Your code builds DOM by building a string containing markup. Markup is intended as a transport format eg between server and client and you should avoid using markup to build page content when you have access to the DOM. Building a table. Generally building page content is best done using the DOM interface rather than creating a string ...


2

I don't know if there is a way to avoid the nested loop in this case because you need to do a calc that involves every inner loop index with every outer loop index. But I think that is not necessary to calculate row * mapWidth in every iteration in the inner loop, once that both variables are available outside it for (let row = 0; row < mapHeight; row++) {...


2

If you happen to use a recent versions of Java, you can take avantage of text blocks, i.e. """ (which were introduced as a preview feature in Java 13). They greatly increase the readability of your code by getting the double quotes out of the way while being formattable with the formatted method (similar to String format) : String ...


1

If it's a table, make it a <table>. Write a traditional <tbody> containing <tr>, in turn containing <td>, in turn containing individual <a>. Then the text will be links. This is simpler, doesn't require any fancy CSS, and better communicates your intent to browsers. All of the usual keyboard and mouse functionality will be ...


1

General Feedback The class looks okay. I like how the method names follow PSR-12 recommendation of method names in camelCase, however it is also recommended that an underscore not be used to indicate private properties1 Property names MUST NOT be prefixed with a single underscore to indicate protected or private visibility. That is, an underscore prefix ...


Only top voted, non community-wiki answers of a minimum length are eligible