---
title: "Discussion on \"How can you write variables in JavaScript\" | Hashnode"
description: "Discussion on \"How can you write variables in JavaScript\". There are 3 keywords you can define variables in JavaScript.\n\nUsing var\n function exampleVar() {\n   if (true) {\n     var x = 10;\n   }\n   console.log(x); // Outputs 10\n }\n exampleVar();\n\n Explanation:\n\nVariables declared with var are function-scoped, ..."
url: "https://hashnode.com/posts/how-can-you-write-variables-in-javascript/65819c3101a90e079a959f1c"
---

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

Discussion

# [How can you write variables in JavaScript](https://pixprocoder.hashnode.dev/how-can-you-write-variables-in-javascript?utm_source=hashnode&utm_medium=feed)

There are 3 keywords you can define variables in JavaScript. Using var function exampleVar() { if (true) { var x = 10; } console.log(x); // Outputs 10 } exampleVar(); Explanation: Variables declared with var are function-scoped, ...

Dec 19, 2023 · 2 min read · pixprocoder.hashnode.dev  
Updated Dec 23, 2023  
Read the article

-   [#js](https://hashnode.com/tag/js)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#programming-blogs](https://hashnode.com/tag/programming-blogs)

## Written by

[Samsul kobir](https://hashnode.com/@pixprocoder)

@pixprocoder · Romania, Bucharest

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

Software Engineer || Full stack Developer

It's a Full stack software Engineer 👨‍💻

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
