From da0885a5c38785dfc7dcd240d0d7c48a29c82410 Mon Sep 17 00:00:00 2001 From: Restu Wahyu Saputra Date: Tue, 19 Oct 2021 12:00:58 +0700 Subject: [PATCH 1/2] Add casting type data, Add alternative to parseInt and Add scroll top button --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index 5b7c39f2..1f143905 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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: @@ -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 + +

+ Scroll Top +

From 98fba8f65cd3ccf9e8e8b1a30f2d3302d450276f Mon Sep 17 00:00:00 2001 From: Restu Wahyu Saputra Date: Tue, 19 Oct 2021 12:06:03 +0700 Subject: [PATCH 2/2] add scroll on top --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1f143905..83d71b48 100644 --- a/README.md +++ b/README.md @@ -2295,6 +2295,6 @@ Every single donation is important. Your donation is gonna make a clear statemen [bmc-url]: https://patreon.com/denysdovhan [bmc-image]: https://img.shields.io/badge/support-buymeacoffee-222222.svg?style=flat-square -

- Scroll Top -

+

+ Scroll On Top +