DeveloperBreeze

Tutorials Programming Tutorials, Guides & Best Practices

Explore 149+ expertly crafted tutorials tutorials, components, and code examples. Stay productive and build faster with proven implementation strategies and design patterns from DeveloperBreeze.

Arithmetic Operators

Tutorial December 11, 2024
javascript

  let result = 10 + 5 * 2; // 20
  // Multiplication happens before addition
  // 10 + (5 * 2) = 10 + 10 = 20

  let resultWithParentheses = (10 + 5) * 2; // 30
  // Parentheses alter the order
  // (10 + 5) * 2 = 15 * 2 = 30
  • When adding a number and a string, JavaScript converts the number to a string and concatenates.