Complex Data Structures vs Objects

Is it ok to look at “Complex Data Structures” as “Arrays of Objects”?

I guess a better question is that basically what they are? They seem like they are to me.

Is this really the only thing that separates Objects from being Data Structures?

Final question for anyone who also knows C. Is it ok to think of Objects as being similar to Typedef Struct, and are “Data Structures” in js similar to linked list?


Objects are data structures, a string-keyed map without ordering. A data structure is just the way you structure the container for some data (and hence why there are various common methods of doing it). An object is a data structure, and you can make other data structures out of objects (for example Arrays, Maps and Sets are the other general-purpose structures you get in JS and they’re just built from objects)

Yes, they’re much more freeform though. Also it`s called a struct, typedef is just a keyword used in the code to indicate youre providing a type definition to identify the struct

This doesn’t quite make sense, a linked list is one specific way of structuring a data container, there is no reason why you can’t write a linked list in JS


“Complex data structures” include, but are not limited to linked lists. They may also be trees, graphs, hashtables, etc.

Think of objects as the evolutionary outcome of Typedef Structs.


Objects in themselves can be “complex data structures.” This is a direct quote from the MDN page on data structures:

In JavaScript, objects can be seen as a collection of properties. With the object literal syntax, a limited set of properties are initialized; then properties can be added and removed. Property values can be values of any type, including other objects, which enables building complex data structures. Properties are identified using key values. A key value is either a String or a Symbol value.

So an object contains properties, and those properties can be… anything. Boolean, Number, String, Objects, custom Objects, or Arrays of any type. Or hey – functions!

A complex data structure is anything that is not a simple data structure. A Boolean is simple. A String is simple. A Number is simple (whether integer or floating point). Each of these are a one-dimensional data point. An Array can be complex, but doesn’t really have to be – an array of numbers is still numbers.

An Object, however, is usually intended to hold multiple data related points. A Student object, for example:

class Student {
  constructor({name, age, school, major, gpa}) {
    let newName = name.split(" ");
    this._name = {
      first: newName[0],
      last: newName[1] ? newName[1] : undefined
    this.age = age; = school;
    this.gpa = gpa;

  set name(name){
    let newName = name.split(" ");
    this._name = {
      first: newName[0],
      last: newName[1] ? newName[1] : undefined

  get name(){
    return (this._name.first+" "+this._name.last).trim()

It is complex because it can contain strings, numbers, booleans, arrays, functions or nested objects. Does it need to? No. But it can, should your need arise.


Thanks for the input.

I only put type def due to not having to call a struct or object tag in js Objects.

I also didn’t realize js had linked list. I assumed with C being so basic that js would have a need for it due to some other form or function.

So I guess the better analogy would be nested structures in C.

That’s similar to what I was thinking. They make sense and even the syntax seems very similar at glance.

I am not familiar with C++ or Java. I plan on picking up Java later this year. If you have any insight, is objects in js similar to objects in oop?

Thanks for the input. Love the pic also.

If you’ve ever learned C#, you’ve learned the better version of Java. The biggest difference in JavaScript is that it favors protypical inheritance rather than classical inheritance. (Here is a StackOverflow answer that sums up the difference).

1 Like

Awesome. Thanks for the input.

I feel this is still slightly over my knowledge in js, mainly due to not knowing much syntax atm.

I’ll have to read over the code again when I get a bit further.


I think I remembered wrong. I thought people were saying oop was hard due to objects being confusing but seeing classes I think it was that.

I can see how it can throw ppl for a loop. I’m still interested in learning them though, but the whole inheritance thing sounds scary lol.

Thanks again.

No you misunderstand: if you want/need a linked list in JS, you have to write a linked list.

A linked list is just one way out of almost infinite possible ways to describe the relationship between pieces of data in some collection.

This is what I’m getting at: a data structure isn’t one specific thing.

An array of objects is just a data structure used for some specific data.

And most programming languages give you a generic version of a few useful data structures. Like C is tiny, but you get structs and arrays and vectors. Some languages give you lots (like Java or C#). Plus most languages normally have some key data structure that lots of other things get built out of. So JS has objects, which it uses as the basis for everything in the language. Or going back to C, it doesn’t have strings, so to represent that data structure it uses arrays instead.

I understand now. Thanks for the clarification.

I really only know a bit of C and have been dipping in and out of data structures in it, mostly due to trying to better learn embedded and studying discrete math to better understand algorithms.

Starting on a newer language is a new process for me so it is hard not to try to compare things in order to understand and make sense of it and stop from feeling like my head is splitting lol.

I also have this fear that I will forget and overwrite the knowledge I have learned from my previous language.