Converting value types in JavaScript

const birthYear= "1991";
console.log(Number(birthYear))
const birthYear= 1991;
console.log(String(birthYear))

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

REST in Peace. Long Live GraphQL

Create Social Network by ReactJS

How to deploy NodeJS application that’s using Google Sheets API (google-spreadsheet) on Heroku

Improve your JavaScript coding with optional chaining

Sending Email With Firebase Functions [Firestore & HTTP Triggers]

jQuery: How to check if the javascript function exist

Leetcode Q494. Target Sum (Q418)

My notes about conducting a massive refactor in a Vue.js website

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Stela Capsa

Stela Capsa

More from Medium

Breaking Down The Call Stack In JavaScript

The Most Useful Array Methods in JavaScript: forEach(), map(), filter() and reduce()

Flatiron First Project Assignment

Javascript arrow functions is a topic of importance and the best part is it’s very easy to…