DEV Community

Carl J
Carl J

Posted on

JS Variables

To start with JS, or any coding platform, we must declare variables... or assign a value to it.
Say you are talking to someone about a subject and spit out a word that has never been heard before. The person you're talking to would not know what that word is, so he/she/they would ask you, "What is this 'word' you speak of?"
So, we have to define this word. It can either be an object, a description, an expression... and so on.
So with JS we can use 'const', 'let', or 'var' to declare that a variable (i.e. "x", "y", "zed", or whatever) is something, well "valuable". Take "x" for example; we know what it is, but the computer surely doesn't know. So let's declare this variable as something important.

const x;
//or
let x;
//or
var x;
Enter fullscreen mode Exit fullscreen mode

We can even give it a value:

const x = 42;
let y = 6*7;
let zed = "pizza pizza";
Enter fullscreen mode Exit fullscreen mode

Well, that's it for now.

Top comments (0)