---
title: "Discussion on \"A Brief History of JavaScript Part 2\" | Hashnode"
description: "Discussion on \"A Brief History of JavaScript Part 2\". JavaScript Prototypes for the confused mind."
url: "https://hashnode.com/posts/a-brief-history-of-javascript-part-2/6235668dbef4c71aa6f0f758"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [A Brief History of JavaScript Part 2](https://adibhasib.hashnode.dev/a-brief-history-of-javascript-part-2?utm_source=hashnode&utm_medium=feed)

JavaScript Prototypes for the confused mind.

Mar 19, 2022 · 3 min read · adibhasib.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#objects](https://hashnode.com/tag/objects)

## Written by

[Adib Hasib](https://hashnode.com/@adibHasib)

@adibHasib · Bangladesh

  
[View profile](https://hashnode.com/@adibHasib)

I like books, poems, music and mountains but currently busy centering divs.

Hello. I'm a Software Engineer from Bangladesh. I like all things JS may it be vanilla or fancy like Next.js. In my free time I like to read, listen to music and climb mountains but currently busy centering divs.

## Responses 1

Markdown supported · ⌘↵ to post

[Victor Souza](https://hashnode.com/@victor0x16)

[Mar 21, 2022](https://hashnode.com/posts/a-brief-history-of-javascript-part-2/6235668dbef4c71aa6f0f758/comment/6237c552bef4c71aa6f12eae)

If you call a property/method and it doesn't exist, it returns undefined:

```
const myObject = {
    city: "Madrid",
    greet: function () {
         console.log(`Greetings from ${this.city}`);
    }
}

myObject.greet(); // Ok: Greetings from Madrid
myObject.country; // undefined
```

However, the prototype chain ends when null is found:

```
Object.prototype // null
```

That is a little weird for me, but I got it :)

[Adib Hasib](https://hashnode.com/@adibHasib), thanks for the great post. I was studying it today so its nice to read it here ✨🎉

[Adib Hasib](https://hashnode.com/@adibHasib)

[Mar 21, 2022](https://hashnode.com/posts/a-brief-history-of-javascript-part-2/6235668dbef4c71aa6f0f758/comment/6237c552bef4c71aa6f12eae#reply-6237f6078e4fae3f767e0617)

You got that right. Whenever we try to access an object property that doesn't exists, we get `undefined`. So we can use this feature to check if an object property exists or not. For example,

```
let str = "The quick brown fox"
let freq = {}

str.split("").forEach(char => {
    freq[char] === undefined ? freq[char] = 1 : freq[char] += 1
})

console.log(freq)
```

This little piece of code makes JS objects behave like hashmaps and count the character frequency in the `str` string.
