forked from HowProgrammingWorks/DataTypes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path7-delete.js
37 lines (28 loc) · 762 Bytes
/
7-delete.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'use strict';
{
const org = 'HowProgrammingWorks';
// delete org; // Raises SyntaxError in strict mode
}
{
const country = {
name: 'Chile',
ruler: 'Augusto Pinochet',
born: 1915,
alive: false,
};
delete country.ruler;
console.dir({ country });
delete country.born;
delete country.population;
console.dir({ country });
}
{
const currencies = ['BTC', 'EUR', 'UAH', 'USD'];
console.log('currencies[1]:', currencies[1], 1 in currencies);
console.log('currencies[2]:', currencies[2], 2 in currencies);
delete currencies[1];
currencies[2] = undefined;
console.dir({ currencies });
console.log('currencies[1]:', currencies[1], 1 in currencies);
console.log('currencies[2]:', currencies[2], 2 in currencies);
}