-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2312a0f
commit df45f88
Showing
25 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const people = [ | ||
{ | ||
name: 'bob', | ||
location: { street: '123 main street', timezone: { offset: '+7:00' } }, | ||
}, | ||
{ name: 'peter', location: { street: '123 Pine street' } }, | ||
{ | ||
name: 'susan', | ||
location: { street: '123 Apple street', timezone: { offset: '+9:00' } }, | ||
}, | ||
] | ||
|
||
people.forEach((person) => { | ||
// console.log(person.name) | ||
// console.log(person.location) | ||
// console.log(person.location.street) | ||
// console.log(person.location.timezone.offset) | ||
// console.log( | ||
// person.location && | ||
// person.location.timezone && | ||
// person.location.timezone.offset | ||
// ) | ||
console.log(person?.location?.timezone?.offset) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Optional Chaining</title> | ||
<link rel="stylesheet" href="../global.css" /> | ||
<link rel="stylesheet" href="./styles.css" /> | ||
</head> | ||
<body> | ||
<h2>Optional Chaining</h2> | ||
<script src="app.js"></script> | ||
</body> | ||
</html> |
Empty file.