r/ProgrammerHumor • • Aug 06 '22

Meme I think she might have Javascript-induced PTSD

Post image
34.6k Upvotes

1.1k comments sorted by

View all comments

Show parent comments

26

u/PregnantOrc Aug 06 '22 edited Aug 06 '22

10101010101010101010

Let's parse why. '10*10' is obviously a String as it contains a mix of characters so we start out with that datatype and keep going until we encounter a modifier such as the '*' which we'll treat as just that, a multiplier. We also know that what follows should be a numeric value so we test if the following '10' passes as an Integer and it does. So now we have "10"*10 and nobody is happy

7

u/SteptimusHeap Aug 06 '22

Use \ in front of your * so it doesn't look funny

3

u/PregnantOrc Aug 06 '22

Thanks. Missed it completely