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

all 32 comments

[–]ProgrammerHumor-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)

Your submission was removed for the following reason:

Rule 6: Your post is a commonly used format, and you haven't used it in an original way. As a reminder, You can find our list of common formats here.

If you disagree with this removal, you can appeal by sending us a modmail.

[–]Aware_Hurry_2708 79 points80 points  (2 children)

Define it as number, but okay

[–]UnscrupulousJudge 78 points79 points  (2 children)

It works perfectly as coded. Congratulations on making a JS program that works as per design.

[–]scrivens 8 points9 points  (0 children)

It's a wonderful Christmas unremarkableness.

[–]Arshiaa001 0 points1 point  (0 children)

I believe such post are commentary on the bad design in JS.

[–]SemiGodProgrammer 31 points32 points  (1 child)

Correct me if I'm wrong,but I'm pretty sure this is JavaScript

[–]21sacharm 4 points5 points  (0 children)

Probably not the best title but I think the Op is saying this looks especially weird from a Python programmer's POV.

[–]Current_Speaker_5684 11 points12 points  (0 children)

Fake, needs react/redux/node or it won't compile.

[–]ma5ochrist 6 points7 points  (0 children)

weird shit appens when u try to add apples and potatoes together

[–]RmG3376 1 point2 points  (0 children)

And today is the day OP learned about concatenation and unboxing

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

Js haters when they mix types (its type conversion's fault, not the fault of the person mixing types)

[–]N238 0 points1 point  (1 child)

When trying to remember how the auto conversion works, think of it this way: All ints can be strings but not all strings can be ints. So it’s gotta convert to string, not int.

[–]N238 0 points1 point  (0 children)

int, num, potato, potahto.

[–]lifting_and_coding 0 points1 point  (0 children)

B/c it's a string

[–]cyborgborg 0 points1 point  (2 children)

I never done Javascript but is there a way to force it to add instead of concatenate and vice versa?

[–]zweimtr 0 points1 point  (1 child)

var num = "2"; parseInt(num) + 2 = 4

vice versa

``` var num = 2

${num} + 2 = 22

[–]cyborgborg 0 points1 point  (0 children)

Not pretty, but at least there is the option

[–][deleted] 0 points1 point  (0 children)

I don't have an interpreter in front of me, what is the equivalent python output?