DEV Community

Cover image for Javascript Basics Part 2
Arya Krishna
Arya Krishna

Posted on

4 3

Javascript Basics Part 2

One of the most important building block of any application is a variable. Beginners usually get confused between variables and their values.

var studentName = "Arya";

Enter fullscreen mode Exit fullscreen mode

Here the var studentName is the variable and Arya is the value that is assigned to that variable.

One of the great tips that I received during my bootcamp classes was that think of a variable as labeled boxes with something placed inside of them. So, declaring a var without value is like having an empty box labeled without anything inside of it. But we know what exactly should we be filling inside the box. The contents of this box could be replaced with another contents.

Always keep a clear mental separation between the concept of variables and their values. Variables are not values themselves, they help us hold or contain the values.

In typical variable naming convention we don't use any special characters but we use something called as camel cased.Camel Case refers to the internal capital letters, which resemble the humps on a camel's back. For example, happinessProject, computerScience, and WordPress are all examples of CamelCase.

Another best practice is to declare the variable in the beginning of the application. This helps the application and ourselves to have an idea of what we are going to use, and what we are planning to modify. Declaring a variable as I said before just gives us an empty container, it doesn't have any meaning since there is no values assigned to the variable. If we redeclare the same variable name twice, it just means we have thrown the first one in trash or that it is of zero importance now since we have redeclared it to a different value.

We are declaring the variable because that makes it possible for us to reuse them throughout our application.

Image of Datadog

The Future of AI, LLMs, and Observability on Google Cloud

Datadog sat down with Google’s Director of AI to discuss the current and future states of AI, ML, and LLMs on Google Cloud. Discover 7 key insights for technical leaders, covering everything from upskilling teams to observability best practices

Learn More

Top comments (0)

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay