Skip to content

Commit d37b781

Browse files
committed
Converted 'objects' to the new code convention
1 parent 233c710 commit d37b781

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

page/javascript-101/objects.md

+21-19
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,30 @@ called a method of the object. Otherwise, they are called properties.
1010
As it turns out, nearly everything in JavaScript is an object -- arrays,
1111
functions, numbers, even strings -- and they all have properties and methods.
1212

13-
<javascript caption="Creating an object literal">
14-
var myObject = {
15-
sayHello : function() {
16-
console.log('hello');
17-
},
18-
myName : 'Rebecca'
19-
};
20-
21-
myObject.sayHello(); // logs 'hello'
22-
23-
console.log(myObject.myName); // logs 'Rebecca'
24-
</javascript>
13+
``` js
14+
// Creating an object literal
15+
var myObject = {
16+
sayHello : function() {
17+
console.log('hello');
18+
},
19+
myName : 'Rebecca'
20+
};
21+
22+
myObject.sayHello(); // logs 'hello'
23+
24+
console.log(myObject.myName); // logs 'Rebecca'
25+
```
2526

2627

2728
When creating object literals, you should note that the key portion of each
2829
key-value pair can be written as any valid JavaScript identifier, a string
2930
(wrapped in quotes) or a number:
3031

31-
<javascript caption="test">
32-
var myObject = {
33-
validIdentifier : 123,
34-
'some string' : 456,
35-
99999 : 789
36-
};
37-
</javascript>
32+
``` js
33+
// test
34+
var myObject = {
35+
validIdentifier : 123,
36+
'some string' : 456,
37+
99999 : 789
38+
};
39+
```

0 commit comments

Comments
 (0)