Skip to content

Commit 0efe384

Browse files
authored
Merge pull request #566 from khaister/patch-1
Update article.md
2 parents f032b4b + 547aead commit 0efe384

File tree

1 file changed

+11
-8
lines changed
  • 1-js/05-data-types/01-primitives-methods

1 file changed

+11
-8
lines changed

1-js/05-data-types/01-primitives-methods/article.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
# Methods of primitives
22

3-
JavaScript allows us to work with primitives (strings, numbers etc) as if they were objects.
3+
JavaScript allows us to work with primitives (strings, numbers, etc.) as if they were objects.
44

5-
They also provide methods to call as such. We will study those soon, but first we'll see how it works, because, of course, primitives are not objects (and here we will make it even more clear).
5+
They also provide methods to call as such. We will study those soon, but first we'll see how it works because, of course, primitives are not objects (and here we will make it even clearer).
66

7-
Let's look at the key distinction between primitives and objects.
7+
Let's look at the key distinctions between primitives and objects.
88

99
A primitive
10-
: Is a value of a primitive type. There are 6 primitive types: `string`, `number`, `boolean`, `symbol`, `null` and `undefined`.
10+
11+
- Is a value of a primitive type.
12+
- There are 6 primitive types: `string`, `number`, `boolean`, `symbol`, `null` and `undefined`.
1113

1214
An object
13-
: Is capable of storing multiple values as properties.
14-
Can be created with `{}`, for instance: `{name: "John", age: 30}`. There are other kinds of objects in JavaScript, e.g. functions are objects.
1515

16-
One of the best things about objects is that we can store a function as one of its properties:
16+
- Is capable of storing multiple values as properties.
17+
- Can be created with `{}`, for instance: `{name: "John", age: 30}`. There are other kinds of objects in JavaScript; functions, for example, are objects.
18+
19+
One of the best things about objects is that we can store a function as one of its properties.
1720

1821
```js run
1922
let john = {
@@ -28,7 +31,7 @@ john.sayHi(); // Hi buddy!
2831

2932
So here we've made an object `john` with the method `sayHi`.
3033

31-
Many built-in objects already exist, such as those that work with dates, errors, HTML elements etc. They have different properties and methods.
34+
Many built-in objects already exist, such as those that work with dates, errors, HTML elements, etc. They have different properties and methods.
3235

3336
But, these features come with a cost!
3437

0 commit comments

Comments
 (0)