DEV Community

Cover image for Digging more into Variables in JavaScript
Arya Krishna
Arya Krishna

Posted on

2 1

Digging more into Variables in JavaScript

Now that we have a basic idea about the variable , we need to understand more about what goes inside those variable which are the different DataTypes.

Everything that we work inside of an application ultimately comes down to Primitive DataTypes.

  • Primitive data types include undefined, string, number and boolean

  • Undefined variables haven't been assigned values yet.If we put nothing inside a variable it is type of UnDefined.

var myUndefined;
Enter fullscreen mode Exit fullscreen mode
  • A string is a series of characters and is surrounded by quotes
var myStringWelcome = "Hello World"; 
Enter fullscreen mode Exit fullscreen mode
  • A number can be either an integer or a decimal
var myNumberInt = 100;
var myNumberDecimal = 100.100;
Enter fullscreen mode Exit fullscreen mode
  • Booleans have two values: true or false
var isMyBooleanTrue = true;
var isMyBooleanFalse = false;
Enter fullscreen mode Exit fullscreen mode

JavaScript is loosely typed, so the type is tied to the value held in the variable, not the variable itself!

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay