Skip to content

Commit 34a49de

Browse files
author
Aaron O'Mullan
committed
Add strings/create exercise with transforms
1 parent 9a071b0 commit 34a49de

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

strings/create.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,26 @@ assert(str === 'abc');
2727
```
2828

2929
---
30+
31+
### Transforming objects to strings with .toString()
32+
33+
Most javascript objects such as `Number`s can be transformed into strings using the `.toString()` method.
34+
35+
---
36+
37+
Create a variable named `numstr` that is a string transformed from the `num` variable.
38+
39+
```js
40+
var num = 27;
41+
```
42+
43+
```js
44+
var num = 27;
45+
var numstr = 27.toString();
46+
```
47+
48+
```js
49+
assert(numstr === '27');
50+
```
51+
52+
---

0 commit comments

Comments
 (0)