How do you check if a variable is an object



How do you check if a variable is an object..

Answer / Smita Singh

In JavaScript, you can use the `typeof` operator to check if a variable is an object. However, the `typeof` operator does not distinguish between different types of objects (like Array or Regular Object). Here's an example:n```javascriptnif(typeof variable === 'object') {n // variable is an objectn}n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More JavaScript Interview Questions

How do I activate javascript on my phone?

1 Answers  


What are the various functional components in javascript?

1 Answers  


How to change video files randomly after completing its execution in Javascript?

1 Answers   HCL,


How long does it take to get good at javascript?

1 Answers  


Explain the working of timers in javascript?

1 Answers  


How to empty an array in JavaScript?

1 Answers  


why can't we call a static method from a non-static method

1 Answers  


Which built-in method returns the string representation of the number’s value?

1 Answers  


Is it possible make a call to server side event of any button using javascript?

1 Answers  


How to create 3-dimensional Array in Javascript?

3 Answers   CybAge, Shapia,


Is notepad ++ an ide?

1 Answers  


What is call(), apply(), and bind()?

1 Answers  


Categories