Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 120556

JavaScript is a versatile, high-level programming language. It is the programming language in all browsers.and can be used for back-end programming with node.js. Use this tag for questions regarding vanilla JavaScript; optionally tagged with an ECMAScript version. If you are using a preprocessor such as TypeScript please tag with that too.

0 votes

Finding duplicates in an array of objects

JavaScript has many hash map options Map, Set, WeakMap, and WeakSet. In this case you can use a Map to index by user id. While adding to the map you can check the number of roles. …
Blindman67's user avatar
  • 22.3k
1 vote

Inserting Characters In Certain Positions Of A String

The title of the question infers that you are interested in the function insert at. However the body of your question implies you are focused on the transformation of a id string. I will review both. …
Blindman67's user avatar
  • 22.3k
3 votes

Recursive Filter/Search function

Bugs Your code will throw errors if you include null, or undefined in the data. And your code does not check for cyclic data structures. First some review points. Review Some general review points re …
Blindman67's user avatar
  • 22.3k
4 votes

Check if object contains only empty nested objects

Some issues? typeof is not a function. eg typeof(input) === 'object' is written typeof input === 'object' null is an Object so when you test for an object using typeof you MUST make sure it is not n …
Blindman67's user avatar
  • 22.3k
2 votes

Storing information in a bad way using localstorage?

Eg let saveInfo = [ should be const saveInfo = [ JavaScript uses undefined to mean "undefined". null is an object used as a place holder to mean "declared but not assigned". …
Blindman67's user avatar
  • 22.3k
7 votes
Accepted

Safely setting object properties with dot notation strings in JavaScript

Just reuse obj Avoid the name set as it is used as a JavaScript token eg create a setter { set val(blah) {...} } Maybe the name could be assignToPath null is also of type "object" so it will pay to extend …
Blindman67's user avatar
  • 22.3k
6 votes
Accepted

Calculate sum of values from checkboxes

Your code is too complex. General points Use textContent when setting text in an HTMLElement rather than innerHTML which forces a reflow. Use a single listener rather than one for each clickable ele …
Blindman67's user avatar
  • 22.3k
4 votes
Accepted

Im trying to show the traffic lights in a loop

Is your question on topic? Your code does not work as expected. However the rules for asking at code review states that code "...works correctly (to the best of your knowledge)" and timing bugs are ve …
Blindman67's user avatar
  • 22.3k
5 votes
Accepted

Using Chained Array Functions to Generate A '-' Separated Random Alpha-Numeric Code

Functions Programmers are lazy. So much so that most of what makes a modern language is all about doing more with less effort. The important concept to understand is the use of functions. Functions l …
Blindman67's user avatar
  • 22.3k
2 votes

Accurate countdown timer

You ask "What am I supposed to do to handle the countdown and keep it counting correctly in case this happens without stopping the timer?" Ignore the fact that the interval was longer than expected …
Blindman67's user avatar
  • 22.3k
3 votes

JavaScript Drag & Drop Sortable List

General coding points The type property in the script tag defaults to type="text/javascript" and is not required. …
Blindman67's user avatar
  • 22.3k
3 votes

JavaScript coding style for initializing variables

As you are not using ; consistently I would say that your init style is dangerous as it will block automatic colon insertion. For example the following lines will throw a syntax error SyntaxError: Un …
Blindman67's user avatar
  • 22.3k
3 votes
Accepted

Listener for property value changes in a Javascript object

Serious BUG! Normally this would make the question "off topic", but unless you are experienced with JS this type of bug is very often overlooked or even considered in normal testing regimes. The bug i …
Blindman67's user avatar
  • 22.3k
2 votes

Smart and Inututive Auto-Format Date Input

Unsafe input modification There are way too many issues with this function for it to be safe to use in the wild. The main reason is when a client modifies the data (change an entered date). Your funct …
Blindman67's user avatar
  • 22.3k
3 votes
Accepted

Pascal Triangle implementation in javascript

Minor style points and an alternative solution. With these types of problems the first port of call is always Wikipedia to get as much info as you can before you start on creating a solution. Two th …
Blindman67's user avatar
  • 22.3k

1
2 3 4 5
33
15 30 50 per page