FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaScript/01 - JavaScript-Basics/ObjectsAndMethods.js at master · lgope/JavaScript · GitHub
lgope
/
JavaScript
Public
Notifications
You must be signed in to change notification settings
Fork
4
Star
11
Code
Issues
0
Pull requests
2
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
JavaScript
/
01 - JavaScript-Basics
/
ObjectsAndMethods.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
36 lines (30 loc) · 716 Bytes
Breadcrumbs
JavaScript
/
01 - JavaScript-Basics
/
ObjectsAndMethods.js
Copy path
File metadata and controls
36 lines (30 loc) · 716 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
var
john
=
{
firstName
:
'John'
,
lastName
:
'Smith'
,
birthYear
:
1992
,
family
:
[
'Jane'
,
'Mark'
,
'Bob'
,
'Emily'
]
,
job
:
'teacher'
,
isMarried
:
false
,
// calcAge: () => {
// this.age = 2018 - this.birthYear;
// }
calcAge
:
function
(
)
{
this
.
age
=
2018
-
this
.
birthYear
;
}
}
;
john
.
calcAge
(
)
;
console
.
log
(
john
)
;
let
anObject
=
{
left
:
1
,
right
:
2
}
;
console
.
log
(
anObject
.
left
)
;
// → 1
delete
anObject
.
left
;
console
.
log
(
anObject
.
left
)
;
// → undefined
console
.
log
(
"left"
in
anObject
)
;
// → false
console
.
log
(
"right"
in
anObject
)
;
// → true
let
objectA
=
{
a
:
1
,
b
:
2
}
;
Object
.
assign
(
objectA
,
{
b
:
3
,
c
:
4
}
)
;
console
.
log
(
objectA
)
;
// → {a: 1, b: 3, c: 4}
Back
|
FazBrowse Home
|
New Git URL