You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: concepts/type-checking/about.md
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,11 +3,13 @@
3
3
Knowning what type an object has is often very important for code to run smoothly and without errors.
4
4
5
5
Javascript has several ways to check the type of an object.
6
-
~~~~exercism/note
6
+
7
+
```exercism/note
7
8
Javascript's type checking mechanisms are always soomewhat unreliable.
8
9
9
10
For true safety with types, you should probably use TypeScript, a language that builds on JavaScript, but with the type syntax of a static-typed language.
10
-
~~~~
11
+
```
12
+
11
13
## The `typeof` operator
12
14
13
15
The `typeof` operator returns the type of its input.
Copy file name to clipboardExpand all lines: concepts/type-checking/introduction.md
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,11 +3,13 @@
3
3
Knowning what type an object has is often very important for code to run smoothly and without errors.
4
4
5
5
Javascript has several ways to check the type of an object.
6
-
~~~~exercism/note
6
+
7
+
```exercism/note
7
8
Javascript's type checking mechanisms are always soomewhat unreliable.
8
9
9
10
For true safety with types, you should probably use TypeScript, a language that builds on JavaScript, but with the type syntax of a static-typed language.
10
-
~~~~
11
+
```
12
+
11
13
## The `typeof` operator
12
14
13
15
The `typeof` operator returns the type of its input.
Copy file name to clipboardExpand all lines: exercises/concept/recycling-robot/.docs/instructions.md
+34-32Lines changed: 34 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,19 +4,20 @@ You have been hired by a recycling center.
4
4
Due to lack of space, all the products are put on the same conveyor belt, but this has lead to different materials mixing together, making them unusable.
5
5
To fix this, you have been tasked with making functions to identify the type of a product.
6
6
7
-
~~~~exercism/note
7
+
```exercism/note
8
8
Many of the later tasks in this exercise can be solved using either `in` or `Object.hasOwn()`.
9
9
To practice, try to solve them with a mix of both.
10
-
~~~~
10
+
```
11
+
11
12
### 1. Check if a value is a boolean
12
13
13
14
Implement the `isBoolean` function, that checks if a value is a boolean.
14
15
15
16
```javascript
16
-
isBoolean(true)
17
+
isBoolean(true);
17
18
// => true
18
19
19
-
isBoolean(null)
20
+
isBoolean(null);
20
21
// => false
21
22
```
22
23
@@ -28,16 +29,16 @@ Sometimes, the device for reading IDs bugs and reads a non-numeric value as `NaN
28
29
Your function should be able to correctly handle this as well.
29
30
30
31
```javascript
31
-
isNumber(42)
32
+
isNumber(42);
32
33
// => true
33
34
34
-
isNumber("Hello, World!")
35
+
isNumber('Hello, World!');
35
36
// => false
36
37
37
-
isNumber(42n)
38
+
isNumber(42n);
38
39
// => true
39
40
40
-
isNumber(NaN)
41
+
isNumber(NaN);
41
42
// => false
42
43
```
43
44
@@ -46,10 +47,10 @@ isNumber(NaN)
46
47
Implement the `isObject` function, that should check if the value is actually an object, not null.
47
48
48
49
```javascript
49
-
isObject({greeting:"Hello"})
50
+
isObject({greeting:'Hello' });
50
51
// => true
51
52
52
-
isObject(25n)
53
+
isObject(25n);
53
54
// => false
54
55
```
55
56
@@ -58,15 +59,14 @@ isObject(25n)
58
59
Implement the `isNumericString` function, that should check if the value is a string but only consists of numbers.
Copy file name to clipboardExpand all lines: exercises/concept/recycling-robot/.docs/introduction.md
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,11 +3,13 @@
3
3
Knowning what type an object has is often very important for code to run smoothly and without errors.
4
4
5
5
Javascript has several ways to check the type of an object.
6
-
~~~~exercism/note
6
+
7
+
```exercism/note
7
8
Javascript's type checking mechanisms are always soomewhat unreliable.
8
9
9
10
For true safety with types, you should probably use TypeScript, a language that builds on JavaScript, but with the type syntax of a static-typed language.
10
-
~~~~
11
+
```
12
+
11
13
## The `typeof` operator
12
14
13
15
The `typeof` operator returns the type of its input.
0 commit comments