<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vector Ojay</title>
    <description>The latest articles on DEV Community by Vector Ojay (@vectorojaydev).</description>
    <link>https://dev.to/vectorojaydev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1139740%2Fb5ffb27e-a18b-4a01-b103-7cb0f64e57b9.jpeg</url>
      <title>DEV Community: Vector Ojay</title>
      <link>https://dev.to/vectorojaydev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vectorojaydev"/>
    <language>en</language>
    <item>
      <title>let j = "JavaScript"(A newbie's guide on Declaring Variables in JavaScript)</title>
      <dc:creator>Vector Ojay</dc:creator>
      <pubDate>Sun, 08 Oct 2023 00:24:25 +0000</pubDate>
      <link>https://dev.to/vectorojaydev/let-j-javascripta-newbies-guide-on-declaring-variables-in-javascript-2a4f</link>
      <guid>https://dev.to/vectorojaydev/let-j-javascripta-newbies-guide-on-declaring-variables-in-javascript-2a4f</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;let j = 'JavaScript'&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You've just embarked on your programming journey, and chances are, you've recently delved into learning JavaScript (an excellent choice, by the way!👍).&lt;br&gt;
Perhaps even before you decided to become a developer, you've come across syntax like the ones in the code below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let j = "JavaScript";
const me = "Developer".
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And you might have wondered what all this jargon really means. Don't worry, I've been in your shoes too! (If that's any consolation).&lt;/p&gt;

&lt;p&gt;The lines of code above are primary examples of how variables are declared in JavaScript.&lt;/p&gt;

&lt;p&gt;One of the initial and fundamental lessons you'll encounter as you dive into JavaScript is how to declare variables. Comprehending the hows and whys of variable declaration is pivotal to your progress, as a newbie developer.&lt;/p&gt;

&lt;p&gt;In this article, we're going to cover everything you need to know about declaring variables in JavaScript: from the basics of what a variable is, to why they hold significance in JavaScript, how values are stored in them, the various data types, different ways in which variables are named, and much more.&lt;/p&gt;

&lt;p&gt;By the end of this article, you should have a solid grasp of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Understanding what variables are and how they affect your code.&lt;/li&gt;
&lt;li&gt;Best practices for naming variables to enhance code readability.&lt;/li&gt;
&lt;li&gt;How to effectively choose between different variable declaration keywords (var, let, const) based on specific use cases.&lt;/li&gt;
&lt;li&gt;The diverse data types that JavaScript offers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And more...&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Values and Data Types&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Introduction to Values as Data or Information&lt;/li&gt;
&lt;li&gt;Various Data Types in JavaScript

&lt;ul&gt;
&lt;li&gt;Primitive Types&lt;/li&gt;
&lt;li&gt;Reference Types&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Variables&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Definition and Purpose of Variables&lt;/li&gt;
&lt;li&gt;Variable Declaration in JavaScript&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Variable Keywords&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;let: The Preferred Keyword for Variable Declaration&lt;/li&gt;
&lt;li&gt;const: Declaring Constants for Unchanging Values&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Variable Assignment and Reassignment&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Variable Naming Conventions&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Importance of Meaningful Names&lt;/li&gt;
&lt;li&gt;Common Naming Conventions

&lt;ul&gt;
&lt;li&gt;Camel Case&lt;/li&gt;
&lt;li&gt;Pascal Case&lt;/li&gt;
&lt;li&gt;Snake Case&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Guidelines for Naming Variables&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Summary and Key Takeaways&lt;/p&gt;
&lt;h2&gt;
  
  
  Values and Data Types:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Introduction to Values as Data or Information:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In JavaScript, a value is simply a piece of data or information that can be used by a program.&lt;br&gt;
 &lt;br&gt;
These values can be of various data types. For instance, they can manifest as a string (which is essentially text, enclosed in single or double quotes, as demonstrated below), a Number (such as 3, 459, or 3000), Booleans (representing true or false), and more.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"Programmer" //this value represents a string.
38 //this value represents a number.
true // this value represents a Boolean.
null // this value represents null.
undefined // this value represents undefined.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Various Data Types in JavaScript&lt;/strong&gt;&lt;br&gt;
There are two categories of Data types in JavaScript:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Primitive Types&lt;/li&gt;
&lt;li&gt;Reference Types&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Primitive Types&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Numbers: Representing both integers and floating-point numbers.&lt;/li&gt;
&lt;li&gt;Strings: Representing pieces of text.&lt;/li&gt;
&lt;li&gt;Booleans: Representing true or false.&lt;/li&gt;
&lt;li&gt;Undefined: Signifying a variable that has been declared but hasn't been assigned a value.&lt;/li&gt;
&lt;li&gt;Null: Denoting the absence of a value.&lt;/li&gt;
&lt;li&gt;Symbol: Representing a unique and unchangeable value.&lt;/li&gt;
&lt;li&gt;BigInt: Catering to large integers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both Symbol and BigInt were the latest data type introductions to &lt;a href="https://262.ecma-international.org/6.0/"&gt;ES6&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Reference Types&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Object, which is a collection of key-value pairs.&lt;/li&gt;
&lt;li&gt;Array, which is a collection of values.&lt;/li&gt;
&lt;li&gt;Function, which is a block of reusable code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Values hold immense importance in JavaScript, as we use them to perform nearly every operation in a program, be it calculations, outputting messages, data validation, updating dates and times, decision-making, and much more.&lt;/p&gt;

&lt;p&gt;In essence, it's safe to say that without values, a JavaScript program is practically useless.&lt;/p&gt;
&lt;h2&gt;
  
  
  Variables:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Definition and Purpose of Variables&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A &lt;a href="https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/Variables"&gt;variable&lt;/a&gt; is essentially a container used to store data or values, like those mentioned above (strings, numbers, etc.). &lt;/p&gt;

&lt;p&gt;Variables make it easier to work with or manipulate values in our code.&lt;br&gt;
To create a variable (or declare a variable, as is normally said in the world of programming) in JavaScript, we use the &lt;code&gt;let&lt;/code&gt; keyword or the &lt;code&gt;const&lt;/code&gt; keyword.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Variable Declaration in JavaScript&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the code below, we are using the let keyword to create a variable called &lt;code&gt;firstName&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let firstName;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now when you type the let or const keyword, you are basically telling JavaScript to create an identifier or memory space, with a certain label name that you give it.&lt;/p&gt;

&lt;p&gt;In the case of the code above, the label name given to that memory space is called &lt;code&gt;firstName&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;We can now go ahead and store some information in that memory space we created. &lt;br&gt;
To store a value inside of a variable, we use the &lt;code&gt;=&lt;/code&gt; sign, also known as the assignment operator in JavaScript, just as in the code below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let firstName = "Vector";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, the value "Vector", has been successfully stored to the variable &lt;code&gt;firstName&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;We can then use the variable name to do operations in our code, instead of the value itself.&lt;/p&gt;

&lt;p&gt;For example, instead of logging the hardcoded value to the console:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log("Vector"); //shows Vector in the console
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can now use the variable &lt;code&gt;firstName&lt;/code&gt; in place of "Vector".&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(firstName); // also shows Vector in the console
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's try to log the value 38, which is a number, to the console:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(38);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, we're simply logging the hardcoded value 38 without storing it in a variable.&lt;/p&gt;

&lt;p&gt;However, we can log the same value to the console in a smarter way by first storing it in a variable, and then using that variable name to log the value:&lt;br&gt;
See the code below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let num = 38;
console.log(num);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the code, we can see that the value 38 was first stored into a variable called &lt;code&gt;num&lt;/code&gt;, and then the name of that variable was used in logging it to the console, instead of the hardcoded value itself.&lt;/p&gt;

&lt;p&gt;With this simple lines of code, we can begin to imagine how crucial variables could be when writing our code.&lt;/p&gt;

&lt;p&gt;Let's imagine a scenario where we have been instructed to log to the console the multiplication table for 2, in our code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(2 * 1); //2
console.log(2 * 2); //4
console.log(2 * 3); //6
console.log(2 * 4); //8
console.log(2 * 5); //10
console.log(2 * 6); //12
console.log(2 * 7); //14
console.log(2 * 8); //16
console.log(2 * 9); //18
console.log(2 * 10); //20
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, let's also assume that there's now a small issue and we have been given a new instruction to switch from the multiplication table of 2 to that of 3.&lt;/p&gt;

&lt;p&gt;This would imply that we would have to go through our code and replace every instance of the number 2 with the number 3, as seen in the code below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(3 * 1); //3
console.log(3 * 2); //6
console.log(3 * 3); //9
console.log(3 * 4); //12
console.log(3 * 5); //15
console.log(3 * 6); //18
console.log(3 * 7); //21
console.log(3 * 8); //24
console.log(3 * 9); //27
console.log(3 * 10); //30
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This would obviously require a lot of work for such a small issue, don't you think?&lt;/p&gt;

&lt;p&gt;And this is precisely why variables are crucial.&lt;/p&gt;

&lt;p&gt;Let's repeat the same process, but this time, we'll first store the number 2 inside a variable called &lt;code&gt;num&lt;/code&gt;, like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;let num = 2;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then, we'll use the variable name, which is &lt;code&gt;num&lt;/code&gt;, to log our multiplication table to the console, just like we did earlier:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(num * 1); //2
console.log(num * 2); //4
console.log(num * 3); //6
console.log(num * 4); //8
console.log(num * 5); //10
console.log(num * 6); //12
console.log(num * 7); //14
console.log(num * 8); //16
console.log(num * 9); //18
console.log(num * 10); //20
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result will still be the same as before, since &lt;code&gt;num&lt;/code&gt; still holds the value of 2.&lt;/p&gt;

&lt;p&gt;So now, if we are asked to change our multiplication table from that of 2, to that of 3, we can now simply do that by changing the value stored in the variable &lt;code&gt;num&lt;/code&gt;, like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;let num = 3;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(num * 1); //3
console.log(num * 2); //6
console.log(num * 3); //9
console.log(num * 4); //12
console.log(num * 5); //15
console.log(num * 6); //18
console.log(num * 7); //21
console.log(num * 8); //24
console.log(num * 9); //27
console.log(num * 10); //30
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And there you have it!&lt;/p&gt;

&lt;p&gt;Thanks to this approach, we avoid the painstaking task of manually replacing every instance of the value 2 in our code, and still achieved the same result.&lt;/p&gt;

&lt;p&gt;Just imagine, if we had calculations like 2 * 1, spanning all the way to 1000.&lt;br&gt;
 &lt;br&gt;
Having to substitute 2 a thousand times? That sounds like an absolute nightmare, doesn't it? 😳&lt;/p&gt;
&lt;h2&gt;
  
  
  Variable Keywords
&lt;/h2&gt;

&lt;p&gt;So now that we've seen a basic example of how things work when we use variables, let's talk about the different keywords we can use to declare variables.&lt;/p&gt;

&lt;p&gt;There are three of them:&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;var&lt;/code&gt;, &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; keywords.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;let: The Preferred Keyword for Variable Declaration&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the codes we wrote above, we mostly used the &lt;code&gt;let&lt;/code&gt; keyword to declare our variables.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;let&lt;/code&gt; keyword is generally used in declaring variables in JavaScript, and is a modern alternative to the older &lt;code&gt;var&lt;/code&gt; keyword.&lt;/p&gt;

&lt;p&gt;It's important to note that the &lt;code&gt;var&lt;/code&gt; keyword is an older, outdated way of declaring a variable, and should preferably not be used when writing your code.&lt;/p&gt;

&lt;p&gt;We use the &lt;code&gt;let&lt;/code&gt; keyword when we want to declare variables that might change or be reassigned later.&lt;/p&gt;

&lt;p&gt;Let's say your nick name is Rossy, and we want to store this information using a variable, as in the code below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let nickName = "Rossy";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we have your nick name, which is "Rossy" stored in a variable named nickName. Right?&lt;/p&gt;

&lt;p&gt;Let's say that you later want to change your nick name from Rossy to Larry, and we have to change that information in the code above.&lt;/p&gt;

&lt;p&gt;We can simply do that by reassigning the variable &lt;code&gt;nickName&lt;/code&gt; to its new value, which is "Larry".&lt;/p&gt;

&lt;p&gt;Here's how we can do that:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nickName = "Larry";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now remember that we learnt earlier that variables are like containers which we use to store data.&lt;/p&gt;

&lt;p&gt;So in the code above, we are simply telling JavaScript to take out the previous value stored inside that container which we named &lt;code&gt;nickname&lt;/code&gt; and replace it with the new value "Larry".&lt;/p&gt;

&lt;p&gt;Note that while reassigning the value, we did not use the &lt;code&gt;let&lt;/code&gt; keyword again. We simply set the already declared variable &lt;code&gt;nickName&lt;/code&gt; to it's new value, which is "Larry".&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;const: Declaring Constants for Unchanging Values&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;On the other hand, we use the &lt;code&gt;const&lt;/code&gt; keyword to declare variables that are constant and would never be reassigned. In other words, when you declare a variable with the &lt;code&gt;const&lt;/code&gt; keyword and store a value inside it, that value can never be changed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const e = 2.71828;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Trying to reassign this variable &lt;code&gt;e&lt;/code&gt; to another value like we did with the &lt;code&gt;let&lt;/code&gt; keyword will return an error in our console.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;e = 3.14; // returns error: Assignment to constant variable
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;While declaring variables, we need to bear the following in mind:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It's preferable not to use the &lt;code&gt;var&lt;/code&gt; keyword, especially as a newbie. It can lead to unexpected behavior in your code, especially in modern JavaScript development.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use the &lt;code&gt;let&lt;/code&gt; keyword for variables that may need to be reassigned.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use the &lt;code&gt;const&lt;/code&gt; keyword for values that would never be reassigned.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It enhances code readability and prevents accidental reassignment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Variable Assignment and Reassignment
&lt;/h2&gt;

&lt;p&gt;We can easily reassign variables that have already been assigned a value.&lt;br&gt;
Let's look at the example code below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let job = "Programmer";
let occupation;
occupation = job;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, we created a variable named &lt;code&gt;job&lt;/code&gt; and assigned it the value "Programmer".&lt;/p&gt;

&lt;p&gt;Then in the second line, we created another variable named &lt;code&gt;occupation&lt;/code&gt;, but we didn't assign any value to it.&lt;/p&gt;

&lt;p&gt;Declaring a variable like that without storing anything in it is like reserving a storage for something later in the future.&lt;/p&gt;

&lt;p&gt;In the third line, we took the content from the &lt;code&gt;job&lt;/code&gt; variable (which is the word "Programmer") and put it into the &lt;code&gt;occupation&lt;/code&gt; variable.&lt;/p&gt;

&lt;p&gt;So now, both &lt;code&gt;job&lt;/code&gt; and &lt;code&gt;occupation&lt;/code&gt; boxes contain the same value, which is the word "Programmer".&lt;/p&gt;

&lt;p&gt;Think of it like copying a word from one box to another. Now, both boxes (&lt;code&gt;job&lt;/code&gt; and &lt;code&gt;occupation&lt;/code&gt;) have the same value inside them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Variable Naming Conventions
&lt;/h2&gt;

&lt;p&gt;There are a number of variable naming conventions in JavaScript. But the most common naming conventions are Camel Case, Pascal Case, and Snake Case&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Camel Case&lt;/strong&gt;: This is the most widely used convention in JavaScript. In this case, the first word is written in lower case, and every other word after it is capitalized (i.e., starts with a Capital letter, and the rest, small letters), just like in the code examples below:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let myVariable;
let totalAmount;
const displayTotalBalance;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pascal Case (Upper Camel Case)&lt;/strong&gt;: This is similar to camel case, but in this case, each word starts with a capital letter, just like in the code example below:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let MyFirstName;
const SecondClass;
let GetUserDetails;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Snake Case&lt;/strong&gt;: In this case, words are normally separated by underscores (_). This convention is not as common in JavaScript as camel case, but you would come across it from time to time. Let's see some examples in the code below:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let my_first_name;
const second_class;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Guidelines for Naming Variables
&lt;/h2&gt;

&lt;p&gt;Being able to name variables efficiently is one of the skills that makes a developer stand out, in programming.&lt;/p&gt;

&lt;p&gt;When naming variables in JavaScript, below are some of the guidelines to consider:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Meaningful Names: Choose names that accurately describe the purpose or content of the variable or function. Avoid generic names like temp or x.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Avoid Reserved Words: Don't attempt to use JavaScript's reserved words or keywords as variable names. For example, don't name a variable var, function, or true.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let function;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is bad practice!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Consistency: It's important to always maintain consistent naming conventions throughout your codebase. This makes it easier for developers (including your future self) to read and understand the code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use Descriptive Names: Choose names that clearly convey the purpose of the variable or function. This helps improve the self-documenting nature of your code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Variable names should only contain letters, digits, or the dollar symbol &lt;code&gt;$&lt;/code&gt; and underscore &lt;code&gt;_&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The first character in your variable name should never be a digit.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Summary and key Takeaways&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Variables in JavaScript are like containers that store different types of information, like numbers or text. &lt;/p&gt;

&lt;p&gt;Using variables allows for more efficient code writing and makes it easier to make changes or updates. &lt;/p&gt;

&lt;p&gt;For example, when using variables, switching from one value to another is as simple as reassigning the variable, rather than manually replacing each instance of the value in the code.&lt;/p&gt;

&lt;p&gt;In conclusion, understanding how to declare and use variables in JavaScript is a fundamental skill for any programmer. &lt;/p&gt;

&lt;p&gt;It enables efficient data management and enhances code flexibility and readability. &lt;/p&gt;

&lt;p&gt;By following naming conventions and choosing meaningful names, developers can create more maintainable and understandable code.&lt;/p&gt;

&lt;p&gt;I hope you found this article helpful, as a newbie, or an experienced programmer. If you did, feel free to leave a comment in the comment section, or add a suggestion if you think I omitted something.&lt;/p&gt;

&lt;p&gt;Happy Coding!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>newbie</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
