“operador ternário” Respostas de código

Operador ternário

condition ? expression-if-true : expression-if-false;

function findGreater(a, b) {
  return a > b ? "a is greater" : "b is greater";
}
Owlthegentleman

operador ternário

// syntax:
condition ? console.log("true") : console.log("false");
// e.g:
let n = 15;
n % 2 === 0 ? console.log("even number") : console.log("odd number");
5alidshammout

ternário

let greeting = ( isBirthday ) ? 'Happy birthday Mrs. Smith — we hope you have a great day!' : 'Good morning Mrs. Smith.';
Outrageous Osprey

Operador ternário

condition ? exprIfTrue : exprIfFalse
The conditional (ternary) operator is the only JavaScript operator that takes three operands: a condition followed by a question mark ( ? ), then an expression to execute if the condition is truthy followed by a colon ( : ), and finally the expression to execute if the condition is falsy
Muhammad

Operador ternário

$check = CONDITION ? "Do this if the statement true" : "Do This if the statement false"
Pogi

operador ternário

$customer->user->fullName ?? ''

$customer->user->fullName ? $customer->user->fullName : ''
  
isset($customer->user->fullName) ? $customer->user->fullName : ''
calyCoder

Respostas semelhantes a “operador ternário”

Perguntas semelhantes a “operador ternário”

Procure respostas de código populares por idioma

Procurar outros idiomas de código