DEV Community

Natália Catunda
Natália Catunda

Posted on

2

Strings and Numbers on JS, pills...

Image description
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));

Enter fullscreen mode Exit fullscreen mode
  • Second pill use .toString() ::

let number="55 86 4232 5267";
console.log("my cellphone number is" + number.toString());

Enter fullscreen mode Exit fullscreen mode

Numbers to String

  • Thirth pill use Number:
let width = "90";
let height = "25";
console.log(Number(width) * Number(height));
Enter fullscreen mode Exit fullscreen mode
  • Fourth pill use +
let width = "9000";
let height = "80";
console.log( + width * + height);
Enter fullscreen mode Exit fullscreen mode

happy coding!! :))

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay