---
title: "Comment by Alex Sunny on \"Primitive vs Reference types in javascript\" | Hashnode"
description: "Hello, if (true) { var language1 = &quot;js&quot;; // language1 is of global scope. let language2 = &quot;c&quot;; // language2 is local to this block const lan"
url: "https://hashnode.com/posts/primitive-vs-reference-types-in-javascript/5f7d5d64eba2f86adc0b6517/comment/5f8af13d6eb39417ce5e5e7f"
---

[Discussion](https://hashnode.com/posts/primitive-vs-reference-types-in-javascript/5f7d5d64eba2f86adc0b6517)

Comment [Primitive vs Reference types in javascript](https://hashnode.com/posts/primitive-vs-reference-types-in-javascript/5f7d5d64eba2f86adc0b6517)

[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
