wip: add ternary operator

chore/javascript
Arik Chakma 1 year ago
parent e4d770e256
commit 041facdc61
  1. 5
      src/data/question-groups/javascript/content/ternary-operator.md
  2. 11
      src/data/question-groups/javascript/javascript.md

@ -0,0 +1,5 @@
The ternary operator is a conditional operator that takes three operands. It is frequently used as a shortcut for the `if` statement.
```js
console.log(condition ? true : false);
```

@ -27,17 +27,17 @@ questions:
answer: In JavaScript, `var` is function-scoped and was traditionally used to declare variables. `let` and `const` are block-scoped. The key difference between `let` and `const` is that `let` allows for reassignment while `const` creates a read-only reference.
topics:
- 'Core'
- 'Intermediate'
- 'Beginner'
- question: What is the difference between `null` and `undefined`?
answer: The `null` is an assignment value. It can be assigned to a variable as a representation of no value. But the `undefined` is a primitive value that represents the absence of a value, or a variable that has not been assigned a value.
topics:
- 'Core'
- 'Intermediate'
- 'Beginner'
- question: What is the difference between `==` and `===`?
answer: equality-operator.md
topics:
- 'Core'
- 'Intermediate'
- 'Beginner'
- question: What are the different ways to declare a variable in JavaScript?
answer: There are three ways to declare a variable in JavaScript `var`, `let`, and `const`.
topics:
@ -48,4 +48,9 @@ questions:
topics:
- 'Core'
- 'Intermediate'
- question: What is ternary operator in JavaScript?
answer: ternary-operator.md
topics:
- 'Core'
- 'Intermediate'
---

Loading…
Cancel
Save