Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ Currently, there are these translations of **wtfjs**:
- [Split a string by a space](#split-a-string-by-a-space)
- [A stringified string](#a-stringified-string)
- [Non-strict comparison of a number to `true`](#non-strict-comparison-of-a-number-to-true)
- [Casting type data](#casting-type-data)
- [Alternative to parseInt](#alternative-to-parseint)
- [📚 Other resources](#-other-resources)
- [🤝 Supporting](#-supporting)
- [🎓 License](#-license)
Expand Down Expand Up @@ -2212,6 +2214,26 @@ Boolean(1.1); // -> true
1.1 == true; // -> false
```

## Casting type data
```js
var nowYears = "2021"
var nextYears = 2022

Number(nowYears) // 2021
String(nextYears) // "2021"

typeof Number(nowYears) // number
typeof String(nextYears) // string
```

## Alternative to parseInt
```js
var nowYears = "2021"

+nowYears // 2021
parseInt(nowYears) // 2021
```

### 💡 Explanation:

According to the specification:
Expand Down Expand Up @@ -2272,3 +2294,7 @@ Every single donation is important. Your donation is gonna make a clear statemen
[patreon-image]: https://img.shields.io/badge/support-patreon-F96854.svg?style=flat-square
[bmc-url]: https://patreon.com/denysdovhan
[bmc-image]: https://img.shields.io/badge/support-buymeacoffee-222222.svg?style=flat-square

<p align="right" style="padding: 5px; border-radius: 100%; background-color: blue; font-size: 2.5rem;">
<b><a href="#what-the-fck-javascript">Scroll On Top</a></b>
</p>