Timeline for Check if a value is an object in JavaScript
Current License: CC BY-SA 4.0
85 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 5 at 22:57 | review | Close votes | |||
| Oct 6 at 19:22 | |||||
| Oct 1, 2024 at 19:50 | answer | added | Rafid Muhymin Wafi | timeline score: -1 | |
| Aug 21, 2024 at 5:53 | answer | added | Wakil Ahmed | timeline score: -1 | |
| Apr 27, 2024 at 11:08 | answer | added | Géry Ogam | timeline score: 1 | |
| Oct 4, 2023 at 19:50 | answer | added | Bendegúz Kálmán | timeline score: -1 | |
| Jul 6, 2023 at 22:46 | answer | added | Sideways S | timeline score: -1 | |
| Feb 17, 2023 at 16:38 | answer | added | PHP Guru | timeline score: -1 | |
| Jan 21, 2023 at 12:48 | answer | added | zlatanned | timeline score: 2 | |
| Oct 3, 2022 at 9:35 | answer | added | Ayodeji Erinfolami | timeline score: 2 | |
| Sep 28, 2022 at 16:40 | answer | added | Paul M. | timeline score: 3 | |
| Sep 22, 2022 at 15:54 | answer | added | mattpr | timeline score: -1 | |
| Jul 28, 2022 at 22:26 | comment | added | danday74 | Use lodash _.isPlainObject which covers all the basic use cases and more - lodash.com/docs/#isPlainObject | |
| May 27, 2022 at 5:19 | comment | added | Jason C | Very related: stackoverflow.com/questions/38304401/… (dupe debatable)... and maybe more what most people finding this page are thinking of, I assume. I.e. looking specifically for dictionaries. Well, it's what I was thinking of, anyways. | |
| Apr 15, 2022 at 14:23 | answer | added | Mayank Singh | timeline score: 3 | |
| Feb 18, 2022 at 22:06 | answer | added | STEVE K. | timeline score: 0 | |
| Dec 30, 2021 at 20:09 | comment | added | Михаил | In Vue 3 (composition API) when use "typeof variable" - I get "Object" everithing because of Proxy. Then i use just a " if (variable.length)" -> for Oblject it'll be "undefined" and you can use if statement. | |
| May 2, 2021 at 15:50 | answer | added | Sandeep Amarnath | timeline score: 1 | |
| Dec 3, 2020 at 14:54 | answer | added | daniellalasa | timeline score: 1 | |
| Oct 3, 2020 at 11:40 | answer | added | Nidhal Ben Tahar | timeline score: -1 | |
| Sep 25, 2020 at 22:52 | history | edited | Kamil Kiełczewski | CC BY-SA 4.0 |
edited body; edited tags
|
| Sep 25, 2020 at 22:41 | answer | added | Kamil Kiełczewski | timeline score: 11 | |
| Jun 23, 2020 at 10:29 | answer | added | Christiyan | timeline score: 9 | |
| Jun 8, 2020 at 10:40 | comment | added | HalfWebDev | @tiffon How about a to the point answer at stackoverflow.com/a/52478680/1096194. I wrote this when I was overwhelmed by seeing the length of detail in many of the highest voted answers. I believe it deserves a lot more visibility. | |
| May 8, 2020 at 17:42 | answer | added | Jayant Bhawal | timeline score: 24 | |
| Apr 12, 2020 at 21:48 | answer | added | insign | timeline score: 8 | |
| Dec 26, 2019 at 13:43 | comment | added | Don Hatch | It would be great if you could start by saying what exactly you mean by "is an Object". (Or, say explicitly that part of the answer you're seeking is to nail down various popular meanings of "is an object" and then differentiate between them.) Lacking that, everyone is talking past each other. | |
| Dec 12, 2019 at 19:06 | comment | added | ICW |
@user395760 Literally every definition in programming conflicts with another definition. The definition that makes the most sense to OP is A javascript object is a javascript object such as '{}'. Explain to me why null would be considered an object ever? If you consider null an object, you may as well consider every single variable in javascript an object.
|
|
| Nov 27, 2019 at 18:28 | answer | added | redeemefy | timeline score: 8 | |
| Sep 10, 2019 at 2:11 | answer | added | Gust van de Wal | timeline score: 10 | |
| Aug 28, 2019 at 10:35 | answer | added | Jitender | timeline score: 7 | |
| Nov 12, 2018 at 14:06 | answer | added | c7x43t | timeline score: 10 | |
| Sep 24, 2018 at 11:45 | answer | added | HalfWebDev | timeline score: 27 | |
| Jul 27, 2018 at 9:14 | comment | added | Mayur Shedage | const isEmpty = thing => { typeof thing === "object" ? !thing || !Object.keys(thing).length : !thing && thing !== 0 }; | |
| Jul 21, 2018 at 16:27 | answer | added | Erisan Olasheni | timeline score: 102 | |
| Jul 9, 2018 at 9:01 | answer | added | Exception | timeline score: 3 | |
| Jun 6, 2018 at 3:58 | answer | added | GuaHsu | timeline score: 3 | |
| May 23, 2018 at 0:02 | answer | added | eQ19 | timeline score: 0 | |
| Apr 16, 2018 at 14:22 | answer | added | sasi | timeline score: 14 | |
| Feb 22, 2018 at 21:34 | answer | added | openai_sucks | timeline score: 13 | |
| Feb 16, 2018 at 7:30 | answer | added | Mahak Choudhary | timeline score: 7 | |
| Nov 12, 2017 at 11:11 | answer | added | ajayv | timeline score: 0 | |
| Oct 10, 2017 at 9:21 | answer | added | cn0047 | timeline score: 102 | |
| Jul 19, 2017 at 6:48 | answer | added | Mohideen bin Mohammed | timeline score: -1 | |
| Apr 24, 2017 at 13:19 | answer | added | JohnPan | timeline score: 3 | |
| Apr 8, 2017 at 3:48 | answer | added | am05mhz | timeline score: 5 | |
| Apr 5, 2017 at 6:41 | answer | added | pizzarob | timeline score: 8 | |
| Feb 15, 2017 at 13:39 | answer | added | Alireza | timeline score: 31 | |
| Feb 13, 2017 at 10:53 | history | edited | Zanon | CC BY-SA 3.0 |
edited body
|
| Feb 8, 2017 at 11:52 | comment | added | FrancescoMM | IMHO it really depends on what you (the one seeking for an answer to this question) consider an Object, and why you are checking it. This question gives different answers if you are trying to distinguish Arrays (that are Objects) from other Objects or if you are trying to separate scalar values from "vectors". And whether null (that is an Object, according to typeof) or Functions (that are Objects) should be excluded or not, it really depends on why you are checking it. That's why there are so many answers and most of them, in context, are correct. | |
| Nov 17, 2016 at 23:43 | answer | added | Inanc Gumus | timeline score: 19 | |
| Oct 20, 2016 at 11:51 | history | edited | Qix - MONICA WAS MISTREATED | CC BY-SA 3.0 |
added 4 characters in body
|
| Sep 22, 2016 at 2:04 | answer | added | bobZBy | timeline score: -4 | |
| S Sep 4, 2016 at 20:21 | history | bounty ended | Oriol | ||
| S Sep 4, 2016 at 20:21 | history | notice removed | Oriol | ||
| Sep 4, 2016 at 19:25 | history | edited | Michał Perłakowski | CC BY-SA 3.0 |
deleted 16 characters in body; edited tags; edited title
|
| Sep 3, 2016 at 15:56 | history | protected | Oriol | ||
| Aug 28, 2016 at 20:19 | history | edited | Oriol | CC BY-SA 3.0 |
Variables have values, but aren't. Only values can be objects
|
| S Aug 28, 2016 at 20:16 | history | bounty started | Oriol | ||
| S Aug 28, 2016 at 20:16 | history | notice added | Oriol | Reward existing answer | |
| Aug 28, 2016 at 0:48 | answer | added | Oriol | timeline score: 21 | |
| Jul 12, 2016 at 22:28 | answer | added | Emil | timeline score: -8 | |
| Jun 10, 2016 at 7:41 | answer | added | Isla | timeline score: 13 | |
| Apr 25, 2016 at 3:06 | answer | added | EthanZhong | timeline score: -5 | |
| Jan 18, 2016 at 21:12 | answer | added | last-child | timeline score: 30 | |
| Nov 17, 2015 at 21:11 | comment | added | tiffon | OP, IMO you should accept @Daan's answer as it is the best solution and should be listed above other answers so it is seen first. (No offense to others who also have good answers.) | |
| Oct 25, 2015 at 16:26 | answer | added | Emilio Grisolía | timeline score: 18 | |
| May 20, 2015 at 11:34 | answer | added | Robert | timeline score: 2 | |
| Dec 16, 2014 at 0:49 | answer | added | Ira | timeline score: 7 | |
| Oct 20, 2014 at 19:33 | answer | added | Pat | timeline score: 12 | |
| Sep 18, 2014 at 18:42 | answer | added | Michal | timeline score: 9 | |
| Sep 7, 2014 at 22:49 | answer | added | 5260452 | timeline score: 106 | |
| S Mar 24, 2014 at 10:19 | history | suggested | Daan | CC BY-SA 3.0 |
add in title that this is about javascript programming language
|
| Mar 24, 2014 at 10:19 | review | Suggested edits | |||
| S Mar 24, 2014 at 10:19 | |||||
| Mar 18, 2014 at 14:44 | answer | added | Matt Fenwick | timeline score: 639 | |
| Sep 30, 2013 at 22:32 | answer | added | youGuysRock | timeline score: -9 | |
| May 17, 2013 at 11:39 | answer | added | zupa | timeline score: 221 | |
| Feb 5, 2013 at 11:50 | answer | added | Daan | timeline score: 375 | |
| Nov 13, 2012 at 6:20 | answer | added | Christophe | timeline score: 234 | |
| May 9, 2012 at 13:07 | history | edited | bluish | CC BY-SA 3.0 |
deleted 1 characters in body; edited tags; edited title
|
| May 9, 2012 at 11:43 | answer | added | Talha | timeline score: 33 | |
| Dec 14, 2011 at 20:55 | vote | accept | Danny Fox | ||
| Dec 14, 2011 at 20:46 | comment | added | user395760 |
A variable is a variable. It may refer to an object. Also, you may want to define "object" - as the answers and comments show, there are various conflicting definitions (e.g. whether null is an object).
|
|
| Dec 14, 2011 at 20:40 | answer | added | Chuck | timeline score: 2612 | |
| Dec 14, 2011 at 20:39 | answer | added | Michael Krelin - hacker | timeline score: 987 | |
| Dec 14, 2011 at 20:35 | history | asked | Danny Fox | CC BY-SA 3.0 |