GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add strings/create exercise with transforms · josesaranda/javascript@34a49de

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • strings
    • create.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎strings/create.md‎

Copy file name to clipboardExpand all lines: strings/create.md
+23Lines changed: 23 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
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 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.