Click here to Skip to main content
15,890,579 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: Dev time waster ala JSON dialect Pin
F-ES Sitecore11-Dec-19 3:47
professionalF-ES Sitecore11-Dec-19 3:47 
GeneralRe: Dev time waster ala JSON dialect Pin
  Forogar  11-Dec-19 4:27
professional  Forogar  11-Dec-19 4:27 
GeneralRe: Dev time waster ala JSON dialect Pin
Sander Rossel11-Dec-19 4:39
professionalSander Rossel11-Dec-19 4:39 
GeneralRe: Dev time waster ala JSON dialect Pin
raddevus11-Dec-19 4:34
mvaraddevus11-Dec-19 4:34 
GeneralRe: Dev time waster ala JSON dialect Pin
Bernhard Hiller5-Jan-20 21:49
Bernhard Hiller5-Jan-20 21:49 
GeneralRe: Dev time waster ala JSON dialect Pin
englebart11-Dec-19 2:50
professionalenglebart11-Dec-19 2:50 
GeneralRe: Dev time waster ala JSON dialect Pin
mlportersr217-Dec-19 5:42
mlportersr217-Dec-19 5:42 
GeneralYARTH-JS : Yet Another Reason To Hate JavaScript PinPopular
raddevus29-Oct-19 8:45
mvaraddevus29-Oct-19 8:45 
As if you need another reason. Roll eyes | :rolleyes:
But here is a good one that maybe you've seen before.

JavaScript
var extra = null; // feeling like you are initializing a var for later use.

// ## Now, try either of the following lines
extra += 'a' + 'b' + 'c';
extra += "abc";

// Guess what the value of extra is??? G'head and guess.
// Yes it is "nullabc"   What!?! 

// But try it with a number
var numberTest = null;  // feeling like you are initializing a var for later use.
numberTest += 55 + 33 + 38;
//Guess what the value is?
// Yep, 126

Dead | X|
Here's a snapshot (via imgur) of the FireFox dev console[^] in case you find it difficult to believe.
I've been using JS for quite some time and try to stay up on these types of things but this one bit me today. Really quite annoying.

I guess it pre-decides that it's a string so it figures it should convert the null object to the null string. I'm so glad it does that!!! Dead | X| Dead | X| Mad | :mad: Mad | :mad:

Really a PEBKAC error but still quite annoying.
GeneralRe: YARTH-JS : Yet Another Reason To Hate JavaScript PinPopular
Richard Deeming29-Oct-19 9:17
mveRichard Deeming29-Oct-19 9:17 
GeneralRe: YARTH-JS : Yet Another Reason To Hate JavaScript Pin
raddevus29-Oct-19 10:33
mvaraddevus29-Oct-19 10:33 
GeneralRe: YARTH-JS : Yet Another Reason To Hate JavaScript Pin
kmoorevs30-Oct-19 14:36
kmoorevs30-Oct-19 14:36 
GeneralRe: YARTH-JS : Yet Another Reason To Hate JavaScript Pin
Martin ISDN31-Oct-19 23:44
Martin ISDN31-Oct-19 23:44 
GeneralRe: YARTH-JS : Yet Another Reason To Hate JavaScript Pin
raddevus1-Nov-19 5:14
mvaraddevus1-Nov-19 5:14 
GeneralRe: YARTH-JS : Yet Another Reason To Hate JavaScript Pin
Martin ISDN1-Nov-19 6:45
Martin ISDN1-Nov-19 6:45 
GeneralRe: YARTH-JS : Yet Another Reason To Hate JavaScript Pin
jsc423-Nov-19 4:20
professionaljsc423-Nov-19 4:20 
GeneralRe: YARTH-JS : Yet Another Reason To Hate JavaScript Pin
Eddy Vluggen8-Nov-19 8:17
professionalEddy Vluggen8-Nov-19 8:17 
GeneralRe: YARTH-JS : Yet Another Reason To Hate JavaScript Pin
Dominic Burford13-Nov-19 4:44
professionalDominic Burford13-Nov-19 4:44 
GeneralRe: YARTH-JS : Yet Another Reason To Hate JavaScript Pin
Super Lloyd9-Dec-19 15:34
Super Lloyd9-Dec-19 15:34 
GeneralRe: YARTH-JS : Yet Another Reason To Hate JavaScript Pin
raddevus10-Dec-19 3:33
mvaraddevus10-Dec-19 3:33 
GeneralRe: YARTH-JS : Yet Another Reason To Hate JavaScript Pin
markrlondon3-Oct-20 14:17
markrlondon3-Oct-20 14:17 
GeneralRe: YARTH-JS : Yet Another Reason To Hate JavaScript Pin
raddevus4-Oct-20 9:57
mvaraddevus4-Oct-20 9:57 
QuestionMessage Removed Pin
16-Sep-19 19:00
professionalSharath C V16-Sep-19 19:00 
AnswerMessage Removed Pin
17-Sep-19 0:07
protectorNelek17-Sep-19 0:07 
GeneralVisual Studio namespace gotcha Pin
Fueled By Decaff9-Sep-19 4:17
Fueled By Decaff9-Sep-19 4:17 
GeneralRe: Visual Studio namespace gotcha Pin
Nathan Minier17-Sep-19 1:20
professionalNathan Minier17-Sep-19 1:20 

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.