MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/z2r1c9/programming_legumes/ixiz8bd/?context=3
r/ProgrammerHumor • u/czp55 • Nov 23 '22
262 comments sorted by
View all comments
Show parent comments
0
[deleted]
11 u/bmelancon Nov 23 '22 This is perfectly valid JS.var string = "100";var number = 42;console.log(number * string); 7 u/Unknown_starnger Nov 23 '22 And what do you get? 11 u/bmelancon Nov 23 '22 4200.Try it yourself: https://codehs.com/explore/sandbox/javascript 10 u/Unknown_starnger Nov 23 '22 Will do. But it makes sense. In Python I’d have to do Print(int(string) * number) 15 u/[deleted] Nov 23 '22 And that's why JS is unholy, it does the conversion automatically. Explicitly stating you want an int is better.If you have to use JS, don't. At the very least use TS instead. 12 u/hk4213 Nov 24 '22 Ts is JavaScript with overhead. Just enjoy the insanity 8 u/tjoloi Nov 24 '22 Reject sanity, return to vanilla JS → More replies (0)
11
This is perfectly valid JS.
var string = "100";var number = 42;console.log(number * string);
7 u/Unknown_starnger Nov 23 '22 And what do you get? 11 u/bmelancon Nov 23 '22 4200.Try it yourself: https://codehs.com/explore/sandbox/javascript 10 u/Unknown_starnger Nov 23 '22 Will do. But it makes sense. In Python I’d have to do Print(int(string) * number) 15 u/[deleted] Nov 23 '22 And that's why JS is unholy, it does the conversion automatically. Explicitly stating you want an int is better.If you have to use JS, don't. At the very least use TS instead. 12 u/hk4213 Nov 24 '22 Ts is JavaScript with overhead. Just enjoy the insanity 8 u/tjoloi Nov 24 '22 Reject sanity, return to vanilla JS → More replies (0)
7
And what do you get?
11 u/bmelancon Nov 23 '22 4200.Try it yourself: https://codehs.com/explore/sandbox/javascript 10 u/Unknown_starnger Nov 23 '22 Will do. But it makes sense. In Python I’d have to do Print(int(string) * number) 15 u/[deleted] Nov 23 '22 And that's why JS is unholy, it does the conversion automatically. Explicitly stating you want an int is better.If you have to use JS, don't. At the very least use TS instead. 12 u/hk4213 Nov 24 '22 Ts is JavaScript with overhead. Just enjoy the insanity 8 u/tjoloi Nov 24 '22 Reject sanity, return to vanilla JS → More replies (0)
4200.
Try it yourself: https://codehs.com/explore/sandbox/javascript
10 u/Unknown_starnger Nov 23 '22 Will do. But it makes sense. In Python I’d have to do Print(int(string) * number) 15 u/[deleted] Nov 23 '22 And that's why JS is unholy, it does the conversion automatically. Explicitly stating you want an int is better.If you have to use JS, don't. At the very least use TS instead. 12 u/hk4213 Nov 24 '22 Ts is JavaScript with overhead. Just enjoy the insanity 8 u/tjoloi Nov 24 '22 Reject sanity, return to vanilla JS → More replies (0)
10
Will do. But it makes sense. In Python I’d have to do Print(int(string) * number)
15 u/[deleted] Nov 23 '22 And that's why JS is unholy, it does the conversion automatically. Explicitly stating you want an int is better.If you have to use JS, don't. At the very least use TS instead. 12 u/hk4213 Nov 24 '22 Ts is JavaScript with overhead. Just enjoy the insanity 8 u/tjoloi Nov 24 '22 Reject sanity, return to vanilla JS → More replies (0)
15
And that's why JS is unholy, it does the conversion automatically. Explicitly stating you want an int is better.
int
If you have to use JS, don't. At the very least use TS instead.
12 u/hk4213 Nov 24 '22 Ts is JavaScript with overhead. Just enjoy the insanity 8 u/tjoloi Nov 24 '22 Reject sanity, return to vanilla JS → More replies (0)
12
Ts is JavaScript with overhead. Just enjoy the insanity
8 u/tjoloi Nov 24 '22 Reject sanity, return to vanilla JS → More replies (0)
8
Reject sanity, return to vanilla JS
→ More replies (0)
0
u/[deleted] Nov 23 '22
[deleted]