Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

219
Views
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 answers
Answer question

0

Use ... instanceof Array

[3, 3] instanceof Array //> true
({"a": "b"}) instanceof Array //> false
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!