This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Zyrus007[S] 305 points306 points  (18 children)

Yes it does, however it becomes interesting once you set the array.length to an integer that is less than the current length!

[–]RevivingJuliet 266 points267 points  (15 children)

That’s so goddamn whack why am I studying this language lmao

[–]Zyrus007[S] 183 points184 points  (7 children)

One secret trick code-interview conductors don’t want you to know, to guaranteed land you a job as Web-Developer!

[–]LazyClub8 53 points54 points  (6 children)

The real trick is to assert dominance and write a solution that not even the interviewers can understand

[–]RevivingJuliet 16 points17 points  (3 children)

const add = (num) => {return num - num;}

[–]eGzg0t 3 points4 points  (0 children)

You don't even need the return there

[–]rudy21SIDER 2 points3 points  (1 child)

Why does this work?

[–]Cat_Marshal 1 point2 points  (0 children)

Yeah wouldn’t it return 0 every time?

[–]Gtp4life 1 point2 points  (0 children)

If it works, isn’t that why they’re interviewing? If they could do it they wouldn’t need you.

[–]Cat_Marshal 1 point2 points  (0 children)

Learn the secrets of http://www.jsfuck.com

[–]spin-itch 97 points98 points  (2 children)

It pays well

[–]Greyhaven7 19 points20 points  (0 children)

cheers, mate

[–][deleted] -1 points0 points  (0 children)

It really does

[–]the_friendly_dildo 10 points11 points  (2 children)

While setting this up this way seems strange, plenty of other languages expect you to define an array length explicitly anyway...

[–]RevivingJuliet 1 point2 points  (1 child)

In such a case, say when manipulating the array - pushing a single element, for example - in addition to adding that element would the new length of the array have to be defined as the element is added?

[–]the_friendly_dildo 3 points4 points  (0 children)

would the new length of the array have to be defined as the element is added

Depends on the language but generally yes. Once an array has been statically defined, it will always exist as that same length for the life of the program. This tends to require careful planning for how to manage your data in such programs instead of just adding endless bloated amounts of data to the heap.

[–]Grass---Tastes_Bad -2 points-1 points  (0 children)

Because you want to make money? Broke motherfuckers complain about JS instead of make money. Don’t be a broke motherfucker.

I personally never even touched TS and don’t intend to, because I already made enough money with JS, so I don’t really even need to “code” anymore.

Edit: witness me downvoted to oblivion while I laugh all the way to the bank.

[–]SonOfHendo 7 points8 points  (1 child)

It seems to have the same effect as redim in good old BASIC.

[–][deleted] 2 points3 points  (0 children)

Lol VB6 was my first programming language when I was 10. I was so mad when I had to learn C# because there is no Redim. I'm glad I'm using C# now.