# Variable Declaration in Javascript and Java

**URL:** https://forum.pinegrow.com/t/variable-declaration-in-javascript-and-java/5724
**Category:** Javascript
**Created:** [September 30, 2021, 5:48am UTC](https://forum.pinegrow.com/t/variable-declaration-in-javascript-and-java/5724 "2021-09-30T05:48:38Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![ankitdixit](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/ankitdixit/32/3428_2.png) [@ankitdixit](https://forum.pinegrow.com/u/ankitdixit)
#### Post date: [September 30, 2021, 5:48am UTC](https://forum.pinegrow.com/t/variable-declaration-in-javascript-and-java/5724/1 "2021-09-30T05:48:39Z")

</div>

Hello All, I want to know which one is better for Variable Declaration point of view between java and javascript? According to some sources, Java supports static typing which requires variable and type declaration before the compilation and execution. but not an idea about javascript? Can anyone explain to me what’s the exact difference between them?

---

<div class="post-metadata">

### Author: ![TechAkayy](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@TechAkayy](https://forum.pinegrow.com/u/TechAkayy)
#### Post date: [September 30, 2021, 7:29am UTC](https://forum.pinegrow.com/t/variable-declaration-in-javascript-and-java/5724/2 "2021-09-30T07:29:02Z")

</div>

Is this a traffic generating post to the linked site? 😳

Coz the last post by this user had the same link couple of months ago until admins removed the link off it!

---

<div class="post-metadata">

### Author: ![ankitdixit](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/ankitdixit/32/3428_2.png) [@ankitdixit](https://forum.pinegrow.com/u/ankitdixit)
#### Post date: [September 30, 2021, 9:56am UTC](https://forum.pinegrow.com/t/variable-declaration-in-javascript-and-java/5724/3 "2021-09-30T09:56:17Z")

</div>

No, I just provide the source where I have found this information. Due to suggest me abut variable declaration in javascript?

---

<div class="post-metadata">

### Author: ![TechAkayy](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@TechAkayy](https://forum.pinegrow.com/u/TechAkayy)
#### Post date: [September 30, 2021, 10:00am UTC](https://forum.pinegrow.com/t/variable-declaration-in-javascript-and-java/5724/4 "2021-09-30T10:00:56Z")

</div>

JavaScript is weakly typed, probably explore Typescript which evolved for strong typing 👍🏽

---

<div class="post-metadata">

### Author: ![schpengle](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/schpengle/32/238_2.png) [@schpengle](https://forum.pinegrow.com/u/schpengle)
#### Post date: [September 30, 2021, 10:59am UTC](https://forum.pinegrow.com/t/variable-declaration-in-javascript-and-java/5724/5 "2021-09-30T10:59:11Z")

</div>

Hi, Javascript has NOTHING to do with Java.

Javascript was only called JAVAscript due to the surging growth in the use of Java programming language at the time. They hoped to capitalise on the hype surrounding the name JAVA.

That is it.  
End of similarity.

You can also look up Javascript Definitions under the term ECMAscript, which is apparently its more correct name for the Definitions…which… Javascript adheres too.

Ie, Ecmascript lays down the Grammar and language rules that Javascript adheres too.  
But, just like any language, Javascript has a different _accent_ and says somethings its own way, but still complies with the grammar.

SO a bit dated but nice little explanation of Ecmascript/Javascript is here.

> **[What’s the difference between JavaScript and ECMAScript?](https://www.freecodecamp.org/news/whats-the-difference-between-javascript-and-ecmascript-cba48c73a2b5/)**
>
> by Michael Aranda What’s the difference between JavaScript and ECMAScript?I’ve tried googling “the difference between JavaScript and ECMAScript.” I ended up having to wade through a sea of ambiguous and seemingly conflicting results: “ECMAScript is a...

So while this ISN"T what you asked for, it might be interesting in showing just how different Java and Javascript are, and their typing rules etc etc.

SO, since they are so different you might as well ask the difference between type declarations between Javascript and C, C++, etc.

I hope this is of some use.

---

<div class="post-metadata">

### Author: ![Bryan04](https://avatars.discourse-cdn.com/v4/letter/b/7993a0/32.png) [@Bryan04](https://forum.pinegrow.com/u/Bryan04)
#### Post date: [October 14, 2021, 9:33am UTC](https://forum.pinegrow.com/t/variable-declaration-in-javascript-and-java/5724/6 "2021-10-14T09:33:27Z")

</div>

Creating a variable in JavaScript is called " **declaring**" a variable. You declare a JavaScript variable with the var keyword: var carName; After the declaration, the variable has no value (technically it has the value of undefined ).

LINK REMOVED AS POTENTIAL SPAM
