Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add casting type data, Add alternative to parseInt and Add scroll top button #219

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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>