7554425D-0054-440D-B95E-D2ABC13D62CD Created with sketchtool.
Your Saved Info Packages

View your saved Course or Program Packages containing pricing and detailed curriculum.

Speak with a Learning Advisor.

Have any questions? We'll call you.

Fill out the form below and a Learning Advisor will reach out at a time convenient for you.

Please pick a valid date and time between 9 AM and 8 PM eastern (Monday to Friday)

By clicking "Book a call," you accept our Terms and will also receive exclusive offers and updates about new courses, workshops and events.

JavaScript Tutorial

JavaScript Data Types

Ready to start your career in Development? Find out more about BrainStation's Web Development Bootcamp

Every programming language is designed around storing information for your application or website. When storing this information, there is always a need to specify what kind of information is being stored. It could be numerical information or textual data. Sometimes it could be a logical state and sometimes it is a collection or list of information. Hence, every programming language ships with built-in data types also known as primitive data types.

JavaScript as a language provides following primitive data types:

  • Number
  • String
  • Boolean
  • Null
  • Undefined
  • BigInt
  • Symbol

On top of these built-in primitive data types, JavaScript also provides following data types that can be used by combining one or more primitive types.

  • Objects
  • Arrays

Dynamic and Weakly Typed Language

It is important to note that JavaScript is a dynamic and weakly typed language. By that, it means that a variable assigned a value of certain type can be re-assigned a value of different type.

let response = ‘Success’;
console.log(response); // prints ‘Success’

response = true;
console.log(response); // prints true

Typeof Operator

Considering JavaScript is a weakly-typed, dynamic language, it also provides Developers with typeof operator that helps to understand the data type being stored in a certain variable at any given point in time.

const grade = 100;
console.log(typeof grade); // prints number

const greeting = ‘Merry Christmas’;
console.log(typeof greeting); // prints string

const hasGraduated = true;
console.log(typeof hasGraduated); // prints boolean

JavaScript String Length

Sometimes while using strings in JavaScript, there is a need to know the length of the string or textual information stored in a variable. JavaScript provides length property for the same. length property is commonly used when there is a need to find the length of a string or many other data types in JavaScript.

const greeting = ‘Merry Christmas’;
console.log(greeting.length); // prints 15;
Set Password

You already have an account with BrainStation, but you still need to set up a password.