---
title: "Discussion on \"Primitive vs Reference types in javascript\" | Hashnode"
description: "Discussion on \"Primitive vs Reference types in javascript\". In Javascript data types can be classified based on how they are passed:\n\nvalue\n\nBoolean\nnull\nundefined\nString\nNumber\n\n\nreference\n\nArray\nFunction\nObject\n\n\ndata types which are passed by value are called primitive types\n\ndata types which are passed by..."
url: "https://hashnode.com/posts/primitive-vs-reference-types-in-javascript/5f7d5d64eba2f86adc0b6517"
---

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

Discussion

# [Primitive vs Reference types in javascript](https://rohitgeddam.hashnode.dev/primitive-vs-reference-types-in-javascript?utm_source=hashnode&utm_medium=feed)

In Javascript data types can be classified based on how they are passed: value Boolean null undefined String Number reference Array Function Object data types which are passed by value are called primitive types data types which are passed by...

Oct 7, 2020 · 3 min read · rohitgeddam.hashnode.dev  
Read the article

## Written by

[rohit geddam](https://hashnode.com/@rohitgeddam)

@rohitgeddam

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

solving problems 1 bit at a time.

## Responses 1

Markdown supported · ⌘↵ to post

[Alex Sunny](https://hashnode.com/@alexsunny123)

[Oct 17, 2020](https://hashnode.com/posts/primitive-vs-reference-types-in-javascript/5f7d5d64eba2f86adc0b6517/comment/5f8af13d6eb39417ce5e5e7f)

Hello,

if (true) { var language1 = "js"; // language1 is of global scope. let language2 = "c"; // language2 is local to this block const language3 = 'c++'; // language3 is local to this block }

console.log(language1); // prints js console.log(language2); // error because language2 is not visible outside the if block console.log(language3); // error because language3 is not visible outside the if block

To clear out the wind Scope and Context are different things We discussed scope in the above section, and Context is used to refer to the value [topdatingwebsitesx.com/random-talk](https://topdatingwebsitesx.com/random-talk) [topdatingwebsitesx.com/chat-avenue](https://topdatingwebsitesx.com/chat-avenue) [chatrandom.live](https://chatrandom.live/) of this in some particular part of your code. There are functions you can call to change the value of this, we will take about it later ever tried console logging this outside any function. outside any function (in global scope) this is always the Window Object.

thanks alexsunny
