Skip to content

Instantly share code, notes, and snippets.

@periakteon
Created March 22, 2023 14:28
Show Gist options
  • Select an option

  • Save periakteon/9d409309a24cf634e663a37df6956987 to your computer and use it in GitHub Desktop.

Select an option

Save periakteon/9d409309a24cf634e663a37df6956987 to your computer and use it in GitHub Desktop.
FreeCodeCamp: Use the Conditional (Ternary) Operator (Solution)
function checkEqual(a, b) {
// a == b ise, yani "a == b" true dönerse, "Equal" stringi döndür
// else, yani diğer durumlarda, "Not equal" stringi döndür
return a == b ? "Equal" : "Not Equal";
}
console.log(checkEqual(1, 2));
// Not Equal
console.log(checkEqual(5, 5));
// Equal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment