New answers tagged

1 vote

My code.org Game Lab project is running really slowly, how can I optimize the code further?

If you move each game object individually after the player presses a button your game will become slower and slower. The fundamental flaw in your code is that you have nested ...
Kokodoko's user avatar
  • 446
0 votes

Advent of Code 2023 day 1: Trebuchet in JS, part 2

Automatic Semicolon Insertion ASI Generally your use of semicolons is consistent as preferred (use them rather than not) however there is one potential issue. JavaScript requires semicolon. If you do ...
Blindman67's user avatar
  • 21.6k
1 vote

Advent of Code 2023 day 1: Trebuchet in JS

Use functions ALways encapsulate code in a function at the very minimum. Example It should look something like... ...
Blindman67's user avatar
  • 21.6k
-1 votes

Javascript: Profile Lookup from freecodecamp

...
Hector Sevilla's user avatar
1 vote
Accepted

String represents a road. One character travels on the road obeying the stops - Code challenge (advent.js day 5)

carefully read the requirements The original problem asks us to Create a function that simulates the sled's movement ... Somehow you leapt from that to All must be in just one function. I see no ...
J_H's user avatar
  • 17.2k
0 votes

access arrow data

no JSON const rowJson = row.toJSON(); faster way of reading arrow data? That .toJSON() call looks like it's more ...
J_H's user avatar
  • 17.2k
0 votes

Move timestamp to the next Monday 10:01 AM

Yikes! Use a datetime library already, that's what they're there for, it's a solved problem. test suite I didn't see any automated unit tests in this submission. If you want to convince me of ...
J_H's user avatar
  • 17.2k
2 votes

Rubik's cube scrambler with timer and list of solves

I do not have the time to do a review to my quality standards I do not presume to eclipse your star-shine quality standards, rather, in the spirit of of teamwork I offer my modest input based on @...
radarbob's user avatar
  • 7,329
0 votes

Sum of all possible concatenations of array values

You can reduce the line count of Donald's answer to improve readability by: Removing the for loop with Array.reduce(), Using ...
Santiago Bendavid's user avatar
0 votes

A Tic Tac Toe Game Made With Javascript

1 HTML 1.1 HTML Markup Validation ...
tacoshy's user avatar
  • 243
2 votes

Convert camelCase and PascalCase to Title Case

Instead of writing and maintaining this function, one could use this publicly available package: to-case. Sample usage: ...
Lydia Stepanek's user avatar
1 vote
Accepted

Given an array, remove zero or more elements to maximize the reduction where you add odd values and subtract even values

You could simply use this pattern: [greatest value, smallest value, greatest value, smallest value, ...] local maximum, local minimum, ... That means, go until ...
Nina Scholz's user avatar
0 votes

Function that formats number of seconds to total time (days, hours, minutes and seconds)

Instead of doing all the math yourself, here's an alternate way to do unit conversions. I also included a function for zero-padding the numbers to cut down on code repetition. ...
Mark H's user avatar
  • 2,195
0 votes

A Tic Tac Toe Game Made With Javascript

First of all I would separate the UI code from the game logic. You can make the whole game playable in the console by calling functions. Those functions indicate which cell is getting an X or O, and ...
Kokodoko's user avatar
  • 446
0 votes
Accepted

Is this string-comparison function safe against timing attacks?

Is it safe? No. bug let equal = input.length === secret.length In the happy path we assign True and life is good. When we assign False, then de-referencing <...
J_H's user avatar
  • 17.2k

Top 50 recent answers are included