• 0 Posts
  • 10 Comments
Joined 4 months ago
cake
Cake day: February 15th, 2025

help-circle









  • capybara@lemm.eetoProgrammer Humor@programming.devJavaScript
    link
    fedilink
    English
    arrow-up
    36
    arrow-down
    5
    ·
    4 days ago

    To start off… Using arithmetic operators on strings in combination with integers is a pure skill issue. Let’s disregard this.

    If you were to use + where one part is a string, it’s natural to assume a string appending is desired since + is commonly used as a function for this. On the other hand, - is never used for any string operation. Therefore, it’s safe to assume that it relates to actual artihmetics and any strings should therefore be converted to numerical values.

    This is an issue with untyped languages. If you don’t like it, use typescript. End of story.