Strings and Numbers on JS, pills...
Natália Catunda
Posted on November 12, 2022
Hi these are some pills(little conceptional parts) that you can use daily bases of your programmer's life.
So i compill all of Strings to Numbers and Numbers to Strings functions and proprieties that we can use for it in javascript language.
_Strings_to Numbers
- First pill use String() :
let number="55 86 4232 5267";
console.log("My cellphone number is" + String(number));
- Second pill use .toString() ::
let number="55 86 4232 5267";
console.log("my cellphone number is" + number.toString());
Numbers to String
- Thirth pill use Number:
let width = "90";
let height = "25";
console.log(Number(width) * Number(height));
- Fourth pill use +
let width = "9000";
let height = "80";
console.log( + width * + height);
happy coding!! :))
💖 💪 🙅 🚩
Natália Catunda
Posted on November 12, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
javascript How I Created Vanilla Calendar Pro — A Lightweight and Flexible JavaScript Calendar with TypeScript
November 28, 2024