Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

220
Vistas
How to get boolean value from prototype of a variable

I'm trying to check the type of a variable. like below

var a  = {a : '1'}
console.log(Object.getPrototypeOf(a));

var b  = [1,2,3]
console.log(Object.getPrototypeOf(b));

output in MDN playground

> Object {  }
> Array []

Now, I need to get boolean value based on the type.
for,
Object -> true
Array -> false
by using some kind of if conditions or any.

How to get boolean value if the type of variable is object or array ?

I'm mainly looking for somecondition which checks for object type like [3, 3] instanceof Array ==> true checks for array

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Use ... instanceof Array

[3, 3] instanceof Array //> true
({"a": "b"}) instanceof Array //> false
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda