https://codeburst.io/javascript-the-conditional-ternary-operator-explained-cac7218beeff
// -- Example 1 --
// without ternary
if (person.age >= 16) {
person.driver = 'Yes';
} else {
person.driver = 'No';
}
// with ternary
person.driver = person.age >=16 ? 'Yes' : 'No';
// -- Example 2 --
let person = {
name: 'tony',
age: 20,
driver: null
};
person.driver = person.age >=16 ? 'Yes' : 'No';- https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/Object-oriented_JS
- JavaScript OOP Crash Course (ES5 & ES6) (https://www.youtube.com/watch?v=vDJpGenyHaA)
Optional Chaining (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining)
let el = document.querySelector('.zp_33Rq5.zp_49YQRaa')?.querySelectorAll('.mdi-linkedin')[0]?.parentNode?.getAttribute('href');https://rollout.io/blog/yaml-tutorial-everything-you-need-get-started/
---
doe: "a deer, a female deer"
ray: "a drop of golden sun"
pi: 3.14159
xmas: true
french-hens: 3
calling-birds:
- huey
- dewey
- louie
- fred
xmas-fifth-day:
calling-birds: four
french-hens: 3
golden-rings: 5
partridges:
count: 1
location: "a pear tree"
turtle-doves: two