Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Only in rare cases will Array.Sort perform in O(n) time. More likely, it will be O(n log n) time.
See here for more details: https://docs.microsoft.com/en-us/dotnet/api/system.array.sort?view=netframework-4.8
but you are not meeting the requirements
@Voile
IDK about JS terminology, but in C/C++ "expression" is something that has a value, so
for (...)
isn't an expression;var a=1,b=2,c=3
is a statement but not an expression; the only expressions here are1
,2
and3
;The opening part of a
for
loop in JS consists of 3 expressions (separated by;
), and each statement can have multiple run-off statements in a row (separated by,
instead). Sincevar a=1,b=2,c=3
and such is a valid (multi-statement) expression it's a valid for loop. In fact it's valid in C and other languages too:int a,b,c; for(a=1,b=2,c=3;a<10;a++);
is valid and works just as intended.Of course, putting too much stuff inside the for loop is not my style ;-) But I don't think it's that unreadable in the first place.
If you keep mentioning "is this a newb thing" twice in one comment perhaps you should just admit that you're a newbie and you're probably not qualified to give strong opinions about this.
(Yes, I'm talking about those "this is clever but not best practice" comments, they've since long become passive-aggressive assertions about "code that is short and does the task but I don't like it so I have to diss it".)
Also, this is JS, not C or Java or anything. Their syntax look similar but they're very different.
This comment is hidden because it contains spoiler information about the solution
you can initialise more than one variable on a line, eg:
var a, b, c = 1, d = 5;
What about it can you not read? ~submitted from phone