Click here to Skip to main content
15,887,214 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: What's y'all's favorite way of dealing with floating point precision? Pin
Jörgen Andersson22-Mar-24 1:48
professionalJörgen Andersson22-Mar-24 1:48 
GeneralRe: What's y'all's favorite way of dealing with floating point precision? Pin
jmaida21-Mar-24 11:15
jmaida21-Mar-24 11:15 
GeneralRe: What's y'all's favorite way of dealing with floating point precision? Pin
jschell21-Mar-24 16:30
jschell21-Mar-24 16:30 
AnswerRe: What's y'all's favorite way of dealing with floating point precision? Pin
Sander Rossel20-Mar-24 22:35
professionalSander Rossel20-Mar-24 22:35 
GeneralRe: What's y'all's favorite way of dealing with floating point precision? Pin
Jeremy Falcon21-Mar-24 5:06
professionalJeremy Falcon21-Mar-24 5:06 
GeneralRe: What's y'all's favorite way of dealing with floating point precision? Pin
Sander Rossel21-Mar-24 5:54
professionalSander Rossel21-Mar-24 5:54 
GeneralRe: What's y'all's favorite way of dealing with floating point precision? Pin
Jeremy Falcon21-Mar-24 6:22
professionalJeremy Falcon21-Mar-24 6:22 
GeneralRe: What's y'all's favorite way of dealing with floating point precision? Pin
Sander Rossel23-Mar-24 1:43
professionalSander Rossel23-Mar-24 1:43 
Those aren't remove functions.
You forgot shift, which removes the first element.
However, I very rarely need to remove the first or last element specifically.
If I have a reference to an element I don't even know its index, I just want to be able to remove it.
It's just JavaScripts way of saying "it's an array, but you can abuse it as stack or queue."

Splice is also something different entirely.
You need an index and the number of items you want to remove starting at that index.
I can never remember it: array.splice(array.indexOf(something), 1);.
It can also be used to add new elements at the designated index, so clearly not a remove.
The slice methods just returns a portion of the array between the specified indexes, and it sounds too much like splice to be able to remember clearly which is which.
Someone new to JavaScript would never guess what it does or how to use it.

I just want to say array.remove(something); and it should remove something.
A remove function is easy to remember, easy to use and clearly conveys your intent.
I don't care if it just does array.splice(array.indexOf(something), 1); internally, I just want to be rid of that awful syntax.

Everyone who says "splice is JavaScripts remove function" is dead wrong.

GeneralRe: What's y'all's favorite way of dealing with floating point precision? Pin
Jeremy Falcon23-Mar-24 4:57
professionalJeremy Falcon23-Mar-24 4:57 
GeneralRe: What's y'all's favorite way of dealing with floating point precision? Pin
Jeremy Falcon23-Mar-24 5:00
professionalJeremy Falcon23-Mar-24 5:00 
GeneralRe: What's y'all's favorite way of dealing with floating point precision? Pin
Jeremy Falcon21-Mar-24 5:24
professionalJeremy Falcon21-Mar-24 5:24 
GeneralRe: What's y'all's favorite way of dealing with floating point precision? Pin
englebart23-Mar-24 5:47
professionalenglebart23-Mar-24 5:47 
JokeRe: What's y'all's favorite way of dealing with floating point precision? Pin
Richard Deeming20-Mar-24 23:06
mveRichard Deeming20-Mar-24 23:06 
GeneralRe: What's y'all's favorite way of dealing with floating point precision? Pin
Jeremy Falcon21-Mar-24 5:00
professionalJeremy Falcon21-Mar-24 5:00 
AnswerRe: What's y'all's favorite way of dealing with floating point precision? Pin
Gary Wheeler21-Mar-24 1:01
Gary Wheeler21-Mar-24 1:01 
GeneralRe: What's y'all's favorite way of dealing with floating point precision? Pin
Mark Whybird from Brisbane21-Mar-24 20:10
Mark Whybird from Brisbane21-Mar-24 20:10 
AnswerRe: What's y'all's favorite way of dealing with floating point precision? Pin
Marc Clifton21-Mar-24 2:28
mvaMarc Clifton21-Mar-24 2:28 
GeneralRe: What's y'all's favorite way of dealing with floating point precision? Pin
Jeremy Falcon21-Mar-24 4:58
professionalJeremy Falcon21-Mar-24 4:58 
GeneralRe: What's y'all's favorite way of dealing with floating point precision? Pin
Marc Clifton21-Mar-24 7:10
mvaMarc Clifton21-Mar-24 7:10 
AnswerRe: What's y'all's favorite way of dealing with floating point precision? Pin
den2k8821-Mar-24 23:01
professionalden2k8821-Mar-24 23:01 
AnswerRe: What's y'all's favorite way of dealing with floating point precision? Pin
Lloyd Folden 202422-Mar-24 5:33
Lloyd Folden 202422-Mar-24 5:33 
GeneralRe: What's y'all's favorite way of dealing with floating point precision? Pin
Jeremy Falcon23-Mar-24 5:06
professionalJeremy Falcon23-Mar-24 5:06 
AnswerRe: What's y'all's favorite way of dealing with floating point precision? Pin
Matt Bond22-Mar-24 4:45
Matt Bond22-Mar-24 4:45 
GeneralRe: What's y'all's favorite way of dealing with floating point precision? Pin
Jeremy Falcon23-Mar-24 5:06
professionalJeremy Falcon23-Mar-24 5:06 
GeneralRe: What's y'all's favorite way of dealing with floating point precision? Pin
Matt Bond25-Mar-24 2:52
Matt Bond25-Mar-24 2:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.