New answers tagged

1 vote

Find Free Appointment Slots given Opening Times and Booked Appointment Times

Reusable package A tidy function (class, sort of) that is not polluting global space. Try a Immediately Invoked Function Expression (IIFE). It's a bit old school but is very effective. See how that ...
  • 6,875
1 vote

Find Free Appointment Slots given Opening Times and Booked Appointment Times

I think a data restructure would make management a lot easier. openingTimes could use numbers instead of strings for times so parsing is easier. ...
  • 778
1 vote

Split the Bill and calculate the Tip

Regarding the HTML the heading could use the word break opportunity element so that wouldn't need to use two elements (<h4>SPLI<wbr>TTER</h4>) ...
  • 850
3 votes

Minesweeper game implementation in (vanilla) JS

Code review from the outside can be painful. From my own experience I will say that any code can be improved, even the one that seems perfect. However, congratulations on finding the will to figure it ...
0 votes

Choose a marker for the map based on the alerts it has

There are variables and references which are not resolved. Based on the given code this is my review: Let's start with the private functions first, as they seem pretty standalone and straight forward. ...
  • 376
0 votes

function to get title from result object depending on if title is empty

Rule of thumb a lot of developers have is avoid nested conditions if you can and exit out early if you can. By switching up the order of your code slightly you can make it easy to read. So if you ...
0 votes

function to get title from result object depending on if title is empty

1. extract helpers //here checking if the title field is ... You felt it was worth explaining the code using English words. Ok, fair enough, that's a good impulse, ...
  • 9,136
0 votes
Accepted

function to get title from result object depending on if title is empty

You don't need to use ? inside the if(result) block, because you know that its not null or undefined Your two if statements are ...
5 votes

Display properties of a country, from online service

Regarding Vue this code looks quite good. I do however have some issues with the general JavaScript and HTML. I'm not a big fan of using empty strings for missing data. ...
  • 10.6k
4 votes

Display properties of a country, from online service

Simplify Computed className is just lowercase continent name ...
  • 778
0 votes

Text input with currency icon in the center

May be something like ...
  • 856
-2 votes

Sum of all possible concatenations of array values

Short and sweet Python3 way (based on https://codereview.stackexchange.com/a/225289/271529) ...
1 vote
Accepted

Node.js configuration object based on environment variables

Years later, I'm using a different approach of expecting environment-appropriate values in the environment variables and delegating the decision to the execution context. First, we define the values ...
  • 131
2 votes
Accepted

Improving player button control code

Instead of creating a variable for each of these, you can use arrays for the buttons, iframes, and players, and you can use anonymous functions for the click event listeners. ...
2 votes

Refactoring duplicate validation by array column wise

You have two forEach that define item, renaming one (the first to something like num) to ...
  • 778
2 votes

Simple calculator project

Your code works, but it's a bit unreadable due to all the if else statements. One problem is that all the buttons call the same function, causing a lot of checks to ...
  • 436
0 votes
Accepted

Separate a list in two lists using JavaScript

A common name for such operation is partition. An implementation of it might look something like ...
  • 850

Top 50 recent answers are included