Expressões e operadores

Expressões

Option 1:

const fahrenheit = 50;
const celsius = fahrenheit - 32 / 1.8;
console.log(celsius); //=> 32.2
const fahrenheit = 50;
const celsius = fahrenheit - 32 / 1.8;
console.log(celsius); //=> 32.2

Option 2 (grouping operator):

const fahrenheit = 50;
const celsius = (fahrenheit - 32) / 1.8;
console.log(celsisu); //=> 10
const fahrenheit = 50;
const celsius = (fahrenheit - 32) / 1.8;
console.log(celsisu); //=> 10

References:

Operadores

Operator typeOperators
Primary expressionsthis, function, class, function*, yield, yield*, async function*, await, [], {}, /ab+c/i, ( )
Left-hand-side expressionsobject.property, object["property"], new, new.target, super, ...obj
Increment and decrementA++, A--, ++A, --A
Unary operatorsdelete, void, typeof, +, -, ~, !
Arithmetic operators+, -, *, /, %, **
Relational operatorsin, instanceof, <, <=, >, >=
Equality operators==, !=, ===, !==
Bitwise shift operators<<, >>, >>>
Binary bitwise operators&, |, ^
Binary logical operators&&, ||
Assignment operators=, *=, /=, %=, +=, -=, <<=, >>=, >>>=, &=, ^=, |=, [a, b] = [1, 2], {a, b} = {a:1, b:2}
Conditional operator(condition ? ifTrue : ifFalse)
Comma operator,

Referências:

Editar esta página