Notion new formulas share many similarities with JavaScript syntax, though Notion Formula syntax is simplified.

In Notion formulas, parentheses `()`

are used to open and close functions:

```
abs(-20) /* Output: 20 */
```

Code language: JavaScript (javascript)

In Formulas 2.0, you can now also write functions using a dot notation:

```
-20.abs() /* Output: 20 */
```

Code language: JavaScript (javascript)

Commas `,`

are used to separate arguments in functions:

```
add(34, 8) /* Output: 42 */
```

Code language: JavaScript (javascript)

Quotation marks `"`

are used to:

- Denote strings
- Reference property names within the
`prop()`

function. Note this only applies to formulas shown outside of the formula editor, property references are shown as tokens — like`Title`

— inside of it.

```
/* Assume the value of the Name property is "Luffy" */
join(["Monkey D.", prop("Title")], " ") /* Output: Monkey D. Luffy */
```

Code language: JavaScript (javascript)

As in most programming languages, the plus sign `+`

can be used for both numeric addition and string concatenation:

```
38 + 4 /* Output: 42 */
"Monkey" + "D. " + "Luffy" /* Output: Monkey D. Luffy */
```

Code language: JavaScript (javascript)

There are several other operators, which perform calculations on one or more **operands.**

Most operators are **binary operators, **which means they work on two operands:

```
10 / 2 /* Output: 5 */
(4 + 5) == 9 /* Output: true */
9 < 8 /* Output: false */
```

Code language: JavaScript (javascript)

The **ternary operator **(`?`

and `:`

) operates on three operands, and can be substituted for the if function:

```
42 > 25 ? "Yes" : "No" /* Output: Yes */
if(42 > 25, "Yes", "No") /* Output: Yes */
```

Code language: JavaScript (javascript)

When performing mathematical operations, operators follow standard mathematical order of operations.

Refer to the operator precedence guide (which also defines precedence for Boolean operators) for more detail, and remember that you can always use parentheses `()`

to specify the order you want:

```
4 + 8 / 4 - 2 ^ 2 /* Output: 2 */
4 + (8 / 4) - (2 ^ 2) /* Output: 2 */
(4 + 8) / (4 - 2) ^ 2 /* Output: 3 */
/* 👇 simplified */
(12) / (4) /* Output: 3 */
```

Code language: JavaScript (javascript)

Notion’s formula editor includes many functions, which are reusable blocks of code that you can call.

Functions accept one or more **arguments, **operate on the data of those arguments using internal logic, and output a result.

Arguments must be of the correct data type; otherwise, your formula will throw an error.

```
/* function_name(argument_1, argument_2) */
divide(10, 2) /* Output: 5 */
/* Note that spaces between arguments are optional, but commas are required. */
join(["My","Chemical", "Romance"], " ")
/* Output: My Chemical Romance */
```

Code language: JavaScript (javascript)

Functions can accept other functions as arguments. The inner-most functions are executed first, and their **output **is used as the argument value for the function that contains them.

Now that you have an overall understanding of how Notion formula syntax works, you should be able to fully understand the details and examples provided for each constant, operator, and function.