• Skip to main content
  • Skip to search
  • Skip to select language
MDN Web Docs
  • References
    • Overview / Web Technology

      Web technology reference for developers

    • HTML

      Structure of content on the web

    • CSS

      Code used to describe document style

    • JavaScript

      General-purpose scripting language

    • HTTP

      Protocol for transmitting web resources

    • Web APIs

      Interfaces for building web applications

    • Web Extensions

      Developing extensions for web browsers

    • Accessibility

      Build web projects usable for all

    • Web Technology

      Web technology reference for developers

  • Learn
    • Overview / MDN Learning Area

      Learn web development

    • MDN Learning Area

      Learn web development

    • HTML

      Learn to structure web content with HTML

    • CSS

      Learn to style content using CSS

    • JavaScript

      Learn to run scripts in the browser

    • Accessibility

      Learn to make the web accessible to all

  • Plus
    • Overview

      A customized MDN experience

    • AI Help

      Get real-time assistance and support

    • Updates

      All browser compatibility updates at a glance

    • Documentation

      Learn how to use MDN Plus

    • FAQ

      Frequently asked questions about MDN Plus

  • Curriculum New
  • Blog
    • Playground

      Write, test and share your code

    • HTTP Observatory

      Scan a website for free

    • AI Help

      Get real-time assistance and support

  • Log in
  • Sign up for free
  1. 給開發者的 Web 技術文件
  2. JavaScript
  3. JavaScript 參考文件
  4. 運算式與運算子
  5. 加法(+)
    • English (US)
    • Deutsch
    • Español
    • Français
    • 日本語
    • 한국어
    • Português (do Brasil)
    • Русский
    • 中文 (简体)

此頁面由社群從英文翻譯而來。了解更多並加入 MDN Web Docs 社群。

在本文中

  • 嘗試一下
  • 語法
  • 描述
  • 範例
  • 規範
  • 瀏覽器相容性
  • 參見
  1. JavaScript
  2. Tutorials and guides
  3. Beginner's tutorials
    1. Your first website: Adding interactivity
    2. Dynamic scripting with JavaScript
    3. JavaScript frameworks and libraries
  4. JavaScript Guide
    1. Introduction
    2. Grammar and types
    3. Control flow and error handling
    4. Loops and iteration
    5. Functions
    6. Expressions and operators
    7. Numbers and strings
    8. Representing dates & times
    9. Regular expressions
    10. Indexed collections
    11. Keyed collections
    12. Working with objects
    13. Using classes
    14. Using promises
    15. JavaScript typed arrays
    16. Iterators and generators
    17. Internationalization
    18. Meta programming
    19. JavaScript modules
  5. Intermediate
    1. Advanced JavaScript objects
    2. Asynchronous JavaScript
    3. Client-side web APIs
    4. Language overview
    5. JavaScript data structures
    6. Equality comparisons and sameness
    7. Enumerability and ownership of properties
    8. Closures
  6. Advanced
    1. Inheritance and the prototype chain
    2. Memory Management
  7. References
  8. Built-in objects
    1. AggregateError
    2. Array
    3. ArrayBuffer
    4. AsyncFunction
    5. AsyncGenerator
    6. AsyncGeneratorFunction
    7. AsyncIterator
    8. Atomics
    9. BigInt
    10. BigInt64Array
    11. BigUint64Array
    12. Boolean
    13. DataView
    14. Date
    15. decodeURI()
    16. decodeURIComponent()
    17. encodeURI()
    18. encodeURIComponent()
    19. Error
    20. escape() 已棄用
    21. eval()
    22. EvalError
    23. FinalizationRegistry
    24. Float16Array
    25. Float32Array
    26. Float64Array
    27. Function
    28. Generator
    29. GeneratorFunction
    30. globalThis
    31. Infinity
    32. Int16Array
    33. Int32Array
    34. Int8Array
    35. InternalError Non-standard
    36. Intl
    37. isFinite()
    38. isNaN()
    39. Iterator
    40. JSON
    41. Map
    42. Math
    43. NaN
    44. Number
    45. Object
    46. parseFloat()
    47. parseInt()
    48. Promise
    49. Proxy
    50. RangeError
    51. ReferenceError
    52. Reflect
    53. RegExp
    54. Set
    55. SharedArrayBuffer
    56. 字串
    57. Symbol
    58. SyntaxError
    59. Temporal 實驗性質
    60. TypedArray
    61. TypeError
    62. Uint16Array
    63. Uint32Array
    64. Uint8Array
    65. Uint8ClampedArray
    66. undefined
    67. unescape() 已棄用
    68. URIError
    69. WeakMap
    70. WeakRef
    71. WeakSet
  9. Expressions & operators
    1. 加法(+)
    2. Addition assignment (+=)
    3. Assignment (=)
    4. async function expression
    5. async function* expression
    6. await
    7. Bitwise AND (&)
    8. Bitwise AND assignment (&=)
    9. Bitwise NOT (~)
    10. Bitwise OR (|)
    11. Bitwise OR assignment (|=)
    12. Bitwise XOR (^)
    13. Bitwise XOR assignment (^=)
    14. class expression
    15. Comma operator (,)
    16. 條件運算子
    17. 遞減運算子(--)
    18. 屬性的刪除
    19. 解構
    20. 相除運算子(/)
    21. Division assignment (/=)
    22. Equality (==)
    23. 指數運算子(**)
    24. Exponentiation assignment (**=)
    25. function expression
    26. function* expression
    27. Greater than (>)
    28. Greater than or equal (>=)
    29. Grouping operator ( )
    30. import.meta
      1. import.meta.resolve()
    31. import()
    32. in
    33. 遞增運算子(++)
    34. Inequality (!=)
    35. instanceof
    36. Left shift (<<)
    37. Left shift assignment (<<=)
    38. Less than (<)
    39. Less than or equal (<=)
    40. Logical AND (&&)
    41. Logical AND assignment (&&=)
    42. Logical NOT (!)
    43. Logical OR (||)
    44. Logical OR assignment (||=)
    45. 相乘運算子(*)
    46. Multiplication assignment (*=)
    47. 建構子函數的使用
    48. new.target
    49. null
    50. Nullish coalescing assignment (??=)
    51. Nullish coalescing operator (??)
    52. Object initializer
    53. 運算子優先序
    54. 可選串連
    55. Property accessors
    56. Remainder (%)
    57. Remainder assignment (%=)
    58. Right shift (>>)
    59. Right shift assignment (>>=)
    60. Spread syntax (...)
    61. Strict equality (===)
    62. Strict inequality (!==)
    63. 相減運算子(-)
    64. Subtraction assignment (-=)
    65. super
    66. this
    67. typeof
    68. 一元負號運算子(-)
    69. 一元正號(+)
    70. Unsigned right shift (>>>)
    71. Unsigned right shift assignment (>>>=)
    72. void operator
    73. yield
    74. yield*
  10. Statements & declarations
    1. async function
    2. async function*
    3. 區塊
    4. break
    5. class
    6. const
    7. continue 語法
    8. debugger
    9. do...while 語法
    10. Empty statement
    11. export
    12. Expression statement
    13. for 語法
    14. for await...of
    15. for...in
    16. for...of
    17. function
    18. function*
    19. if...else
    20. import
      1. Import attributes
    21. label
    22. let
    23. return
    24. switch
    25. throw
    26. try...catch 語法
    27. var
    28. while 語法
    29. with 已棄用
  11. Functions
    1. 箭頭函式
    2. 預設參數
    3. getter
    4. 方法定義
    5. 其餘參數
    6. setter
    7. The arguments object
      1. arguments.callee 已棄用
      2. arguments.length
      3. arguments[Symbol.iterator]()
  12. Classes
    1. 建構子
    2. extends
    3. Private properties
    4. Public class fields
    5. static
    6. Static initialization blocks
  13. Regular expressions
    1. Backreference: \1, \2
    2. Capturing group: (...)
    3. Character class escape: \d, \D, \w, \W, \s, \S
    4. Character class: [...], [^...]
    5. Character escape: \n, \u{...}
    6. Disjunction: |
    7. Input boundary assertion: ^, $
    8. Literal character: a, b
    9. Lookahead assertion: (?=...), (?!...)
    10. Lookbehind assertion: (?<=...), (?<!...)
    11. Modifier: (?ims-ims:...)
    12. Named backreference: \k<name>
    13. Named capturing group: (?<name>...)
    14. Non-capturing group: (?:...)
    15. Quantifier: *, +, ?, {n}, {n,}, {n,m}
    16. Unicode character class escape: \p{...}, \P{...}
    17. Wildcard: .
    18. Word boundary assertion: \b, \B
  14. Errors
    1. AggregateError: No Promise in Promise.any was resolved
    2. Error: Permission denied to access property "x"
    3. InternalError: too much recursion
    4. RangeError: argument is not a valid code point
    5. RangeError: BigInt division by zero
    6. RangeError: BigInt negative exponent
    7. RangeError: form must be one of 'NFC', 'NFD', 'NFKC', or 'NFKD'
    8. RangeError: invalid array length
    9. RangeError: invalid date
    10. RangeError: precision is out of range
    11. RangeError: radix must be an integer
    12. RangeError: repeat count must be less than infinity
    13. RangeError: repeat count must be non-negative
    14. RangeError: x can't be converted to BigInt because it isn't an integer
    15. ReferenceError: "x" is not defined
    16. ReferenceError: assignment to undeclared variable "x"
    17. ReferenceError: can't access lexical declaration 'X' before initialization
    18. ReferenceError: must call super constructor before using 'this' in derived class constructor
    19. ReferenceError: super() called twice in derived class constructor
    20. SyntaxError: 'arguments'/'eval' can't be defined or assigned to in strict mode code
    21. SyntaxError: "0"-prefixed octal literals are deprecated
    22. SyntaxError: "use strict" not allowed in function with non-simple parameters
    23. SyntaxError: "x" is a reserved identifier
    24. SyntaxError: \ at end of pattern
    25. SyntaxError: a declaration in the head of a for-of loop can't have an initializer
    26. SyntaxError: applying the 'delete' operator to an unqualified name is deprecated
    27. SyntaxError: arguments is not valid in fields
    28. SyntaxError: await is only valid in async functions, async generators and modules
    29. SyntaxError: await/yield expression can't be used in parameter
    30. SyntaxError: cannot use `??` unparenthesized within `||` and `&&` expressions
    31. SyntaxError: character class escape cannot be used in class range in regular expression
    32. SyntaxError: continue must be inside loop
    33. SyntaxError: duplicate capture group name in regular expression
    34. SyntaxError: duplicate formal argument x
    35. SyntaxError: for-in loop head declarations may not have initializers
    36. SyntaxError: function statement requires a name
    37. SyntaxError: functions cannot be labelled
    38. SyntaxError: getter and setter for private name #x should either be both static or non-static
    39. SyntaxError: getter functions must have no arguments
    40. SyntaxError: identifier starts immediately after numeric literal
    41. SyntaxError: illegal character
    42. SyntaxError: import declarations may only appear at top level of a module
    43. SyntaxError: incomplete quantifier in regular expression
    44. SyntaxError: invalid assignment left-hand side
    45. SyntaxError: invalid BigInt syntax
    46. SyntaxError: invalid capture group name in regular expression
    47. SyntaxError: invalid character in class in regular expression
    48. SyntaxError: invalid class set operation in regular expression
    49. SyntaxError: invalid decimal escape in regular expression
    50. SyntaxError: invalid identity escape in regular expression
    51. SyntaxError: invalid named capture reference in regular expression
    52. SyntaxError: invalid property name in regular expression
    53. SyntaxError: invalid range in character class
    54. SyntaxError: invalid regexp group
    55. SyntaxError: invalid regular expression flag "x"
    56. SyntaxError: invalid unicode escape in regular expression
    57. SyntaxError: JSON.parse: bad parsing
    58. SyntaxError: label not found
    59. SyntaxError: missing : after property id
    60. SyntaxError: missing ) after argument list
    61. SyntaxError: missing ) after condition
    62. SyntaxError: missing ] after element list
    63. SyntaxError: missing } after function body
    64. SyntaxError: missing } after property list
    65. SyntaxError: missing = in const declaration
    66. SyntaxError: missing formal parameter
    67. SyntaxError: missing name after . operator
    68. SyntaxError: missing variable name
    69. SyntaxError: negated character class with strings in regular expression
    70. SyntaxError: new keyword cannot be used with an optional chain
    71. SyntaxError: nothing to repeat
    72. SyntaxError: numbers out of order in {} quantifier.