button-icon

Iniciarsesión

Iniciarsesión
Archi's Academy
    Cursos
    Cursos
    #
  • Proyectos
    Proyectos
  • Archi's Academy

    Tracks

    #
  • Blog
    Blog
  • Precios
    Precios
  • Contacto
    Contacto
  • Para clubs universitarios
    Para clubs universitarios

BLACK FRIDAY

85% de descuento durante todo noviembre

whatsapp
Contáctanos
Archi's Academy

Navegación

  • Cursos
  • Proyectos
  • Blog
  • Precios
  • Para clubs universitarios
  • Contacto

Cursos

    Tracks

    • Desarrollo Frontend
    • Desarrollo Backend
    • Control de Calidad (QA)
    • Programación con IA Agentica y LLMs
    • Desarrollo Móvil
    • DevOps

    Legal

    • Política de privacidad
    • Términos de servicio

    Contacto

    +1 (217) 200 90 93
    Suite No: 8, 400 Emmet Street
    Kissimmee, Florida 34741 USA
    [email protected]

    Copyright © Tech Career Yazılım Danışmanlık A.Ş. 2026

    instagramlinkedingithubyoutubexfacebook
    visamastercardstripeiyzicoamerican-express
    ETBIS
    1. Home›
    2. Blog›
    3. Type conversion in JavaScript

    Software Development

    Coding

    Type conversion in JavaScript

    The three most commonly used primitive data types in Javascript are number, string, and boolean. At one point or another, we may run into situations where we would like to carry out an operation but the available values are of different types.
    For instance, we may prompt a user’s birth year and receive it as a string, but to calculate their age, the input string has to be converted into a number. This is where type conversion comes in.
    Type conversion refers to the manual conversion of a value from one type to another.
    Javascript methods for performing type conversion between strings and numbers are:
    Number() - converts a string to a number
    String() - converts a number to a string
    To convert strings and numbers to Boolean values, Boolean() is used. It results in either true or false. There are 5 values that when converted to boolean become false: 0, an empty string(‘ ‘), undefined, NULL, and NaN. They are referred to as falsy values. Everything else is a truthy value and will become true when converted to a boolean, including an empty object.
    It is worth noting that the methods start with capital letters.
    Archis-frontend-developer-trainee

    Victor Muya

    Salı, Haz 29, 2021

    ¿Listo para convertir el conocimiento en habilidades reales?

    Empieza a construir con formación guiada por proyectos y gana experiencia práctica desde el primer día.

    TOC

    Table of Content

    No sections found