The Number data type holds and represents numbers. Numbers can be used with mathematical operators such as add +
and divide /
to perform mathematical operations and calculations.
2 + 2 /* Output: 4 */
6 / 2 /* Output: 3 */
Code language: JavaScript (javascript)
Mathematical operations follow the standard mathematical order of operations (PEMDAS).
3 + 4 * 5 /* Output: 23 */
(3 + 4) * 5 /* Output: 35 */
Code language: JavaScript (javascript)
To learn more, see the guide on operator precedence and associativity:
Notion will automatically convert numbers with more than 21 digits to scientific notation when displayed in the formula property, but will display the full number in the formula editor:
See this in action in this example database:
Automatic Number-to-String Conversion
Numbers will automatically be converted to strings if they are combined with other data types.
"There are " + prop("Members").length() + " members."
/* Output: "There are 12 members." */
["There are", prop("Member"),"members."].join(" ")
/* Output: "There are 12 members." */
Code language: JavaScript (javascript)