Hey Any Forums, I've got a challenge for you, I was sent a challenge, I completed it...

Hey Any Forums, I've got a challenge for you, I was sent a challenge, I completed it, can you guess what this function does? and how would you run this function?

Attached: challenge_.png (826x484, 26.79K)

Takes some arrays and jiggles them around

Sorry Piyush, not doing your homework for you.

It's a function that separates your mom's butt cheeks.

What is this ugly language? JavaScript?

Imagine doing imperative programming in fucking JavaScript.
This code is pig disgusting and 18151893 more complex than it needs to be.

>map, filter
>imperative

Stop using words you don't understand kid.

>let
>mutability out the fucking ass
This is not functional just because you used a map, retard.

You don't know what imperative programming means, "kid"

yes, javascript

Stop trying to samefag kid. Go take whatever remedial intro to programming languages class is offered at your 3rd rate community college and never post again.

mad?

Still don't get what your retarded Leetcode exercise is supposed to do, but here it is with actually idiomatic syntax instead of trying to do C programming in Javascript.

function challenge_function() {
return [...arguments].map((argument) => {
const header = argument.shift();
const obj = argument.reduce((objects, row) => [
...objects,
row.reduce((object, col, index) => ({
...object,
[header[index]]: col
}), {})
], []);

return [...new Set(obj.map((element) => element.id)]
.slice()
.sort()
.map((id) => {
const filtered = obj.filter((el) => el.id === id);
return filtered.reduce((structure, _el, index) => ({
...structure,
...filtered[index]
}), {});
})
});
}

As far as I can tell it's something to do with passing matrixes as parameters (as arrays of arrays), and for each matrix it returns an object with each column header as keys and the last elements of said column as value? Or something to that effect. idk it's just retarded.

Little correction at the end there, the filtered constant is unnecessary.
function challenge_function() {
return [...arguments].map((argument) => {
const header = argument.shift();
const obj = argument.reduce((objects, row) => [
...objects,
row.reduce((object, col, index) => ({
...object,
[header[index]]: col
}), {})
], []);

return [...new Set(obj.map((element) => element.id))]
.slice()
.sort()
.map((id) => {
obj.filter((el) => el.id === id)
.reduce((structure, el) => ({
...structure,
...el
}), {});
})
});
}

Should I give you a hint about what the exercise does? or what is the desired output? Your code doesn't even work.
This is the result of your code:
[
[ undefined, undefined, undefined, undefined ],
[ undefined, undefined, undefined, undefined ],
[ undefined, undefined ]
]

I initally copypasted your code, ran it, and then ran mine on the same input and obtained the same result.

Since your dogshit code contains no types because lmao javascript, nor any documentation, and not even so much as explicit variable names, it could literally do anything and everything depending on what input you give it.

it's stitching together some maps.

beyond that, i don't care what it's supposed to do. if i received the OP snippet in my inbox i'd paste it into greenhouse with rating 0/4, no further explanation required.

>if i received the OP snippet in my inbox i'd paste it into greenhouse with rating 0/4
why? why does it have that it's considered wrong?

functional != immutable
you can change whatever the fuck you want inside the function as long as it doesn't have side effects

1) the signature tells me nothing about what it does; it doesn't even accept args
2) variable names don't tell me anything about their purpose
3) n^3 implementation? is this a joke?
4) return is a hilariously complex expression
5) probably half a dozen other things if i were to actually analyze it

in short, i would post absolutely no comment about it and anyone else reviewing my assessment would not need a comment. this snippet speaks entirely for itself.

i would never work with this candidate.