I hope it was an accident/mistake, otherwise it makes Microsoft look ridiculous as fuck.
Code snippets on Microsoft website shown in form of images.
41–50 of 58 posts
Re: Code snippets on Microsoft website shown in form of images.
#42Earlier quoted context omitted.
I am learning javascript nowadays. Can you describe, what is wrong with this javascript? So that, I won't learn any bad practice.
I'm not the most savvy javascript developer, but I'll take a stab at it. Variable declarations and assignments happen on multiple lines in the 2nd snippet instead of all being defined at once. var currentLanguage = "en"; var spanish = "es"; var german = "de"; var english = "en"; vs var currentLanguage = "en", spanish = "es", german = "de", english = "en"; Additionally, "en" is assigned twice. If you're going to take…
There's nothing wrong with it, especially in JS where accidentally deleting a variable declaration can suddenly turn your variable global.
The problem with the code is more that the code stinks, even after you remove the formatting problems, it looks more like .Net code and it doesn't make any sense.
Re: Code snippets on Microsoft website shown in form of images.
#43How else can you get it to work in IE?
Re: Code snippets on Microsoft website shown in form of images.
#44Someone please explain how this isn't a Reddit-esque tempest in a teapot? Sure, it's silly, but getting angry over it? Ridiculous.
Developers love to complain about other people's minor bugs, and yet hate it when testers open them against their own code. "Who even cares about this?"
Re: Code snippets on Microsoft website shown in form of images.
#45Earlier quoted context omitted.
You are probably right. I've found the MSDN pretty inconsistent. There are a number of C#/VB.net examples that don't have any syntax highlighting at all. It all depends which area you are in.
It's not just MSDN which is inconsistent. Microsoft's web presence in general varies widely. The philosophy appears to highly favor providing access to knowledge/content over standardization of form/presentation. The scale of Microsoft's web properties is vast and they do not waste resources trying to get a herd of cats to goosestep.
Re: Code snippets on Microsoft website shown in form of images.
#46I would like to see how long it stays that way ... people make mistakes, but if you are on the front page of HN for a wrong reason, you leave everything aside and fix it.
I doubt the editors or developers of the MS Translator even know what HN is. I know... it's shocking.
Re: Code snippets on Microsoft website shown in form of images.
#47Earlier quoted context omitted.
I'm not the most savvy javascript developer, but I'll take a stab at it. Variable declarations and assignments happen on multiple lines in the 2nd snippet instead of all being defined at once. var currentLanguage = "en"; var spanish = "es"; var german = "de"; var english = "en"; vs var currentLanguage = "en", spanish = "es", german = "de", english = "en"; Additionally, "en" is assigned twice. If you're going to take…
I don't see a bunch of variable definitions on one line as an improvement, just reads less easily and only feels justified in the case of some low numbers like var x = 0, y = 1, z = 0; // Some looping or similar here I do agree with your using of `english` variable to assign `currentLanguage`.
Re: Code snippets on Microsoft website shown in form of images.
#48Earlier quoted context omitted.
I don't see a bunch of variable definitions on one line as an improvement, just reads less easily and only feels justified in the case of some low numbers like var x = 0, y = 1, z = 0; // Some looping or similar here I do agree with your using of `english` variable to assign `currentLanguage`.
Personally, I like doing all the declarations on their own line as well. But anytime I've used JSLint in the past, I seem to recall it complaining about that. Perhaps I'm mistaken?
Using a single var and putting each declaration on its line is not incompatible:
var foo = 4,
bar = 5,
baz = 6,
qux = 'quux;Re: Code snippets on Microsoft website shown in form of images.
#49The site has something to do with javascript on the web, which is very close to html/css, and it does not ever use formatting as seen on many other sites (code coloring).
(Okay, I'm total html/css/js noob, never done a web page in my life, but I think it's wrong).
And in the past examples were showing just right in MSDN, along with way to switch between C#/C++/VB/etc.
Re: Code snippets on Microsoft website shown in form of images.
#50Earlier quoted context omitted.
Personally, I like doing all the declarations on their own line as well. But anytime I've used JSLint in the past, I seem to recall it complaining about that. Perhaps I'm mistaken?
I expect JSLint was whining about using multiple `var` statements. Using a single var and putting each declaration on its line is not incompatible: var foo = 4, bar = 5, baz = 6, qux = 'quux;
var foo = 4,
bar = 5,
baz = 6,
sprinkles = 'wee';
qux = 'quux';
Making `qux` global.