Variable Declaration in Javascript and Java

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?

Is this a traffic generating post to the linked site? :flushed:

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

1 Like

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

JavaScript is weakly typed, probably explore Typescript which evolved for strong typing :+1:t4:

1 Like

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.

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.

1 Like

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