Back to Course

Introduction to JavaScript

0% Complete
0/0 Steps
  1. JavaScript: Basics
    9Topics
    |
    10 Quizzes
  2. JavaScript: Variables
    9Topics
    |
    10 Quizzes
  3. JavaScript: Conditional Statements
    10Topics
    |
    11 Quizzes
  4. JavaScript: Functions
    10Topics
    |
    11 Quizzes
  5. JavaScript: Scope
    6Topics
    |
    7 Quizzes
  6. JavaScript: Arrays
    11Topics
    |
    12 Quizzes
  7. JavaScript: Loops
    8Topics
    |
    9 Quizzes
  8. JavaScript: High Order Functions
    3Topics
    |
    4 Quizzes
  9. JavaScript: Iterators
    6Topics
    |
    6 Quizzes
Lesson 1, Topic 4
In Progress

JavaScript: Data Types

Yasin Cakal 26 Oct 2021
Lesson Progress
0% Complete

Data types are the categories that we assign to the various types of data while programming. There are seven basic data types in JavaScript i.e Number, String, Boolean, Null, Undefined, Symbol, and Objects. The first six of these types are known as primitive data types. They are the language’s most fundamental data kinds. Objects are more complicated, and as you advance through JavaScript, you’ll learn a lot more about them

Number: Any number, including decimal numbers, comes under this data type for example 9,10,4.2 , 11.

String: Any arrangement of characters on your keyboard (letters, numbers, spaces, symbols, and so on) surrounded by single or double quotes such as '…'  and "…" respectively. However, we prefer single quotes. 

Boolean: This data type has only two possible values: true or false (without quotes). It’s useful to think of booleans as on/off switches or as “yes” or “no” replies to questions.

Null: The keyword null indicates this data type, which represents the intentional absence of a value (without quotes).

Undefined: The keyword undefined (without quotes) denotes this data type.  Likewise null it also denotes the absence of a value, but it is used in a different way than null.

Symbol: A newer addition to the language, symbols are unique identifiers that prove to be useful in more complicated code. There is no need to be concerned about these for the time being

Objects: These are groups of data that are related in some way.

At first glance, seven types may not seem like a lot, but after you start using each one, you’ll notice the universe opens up with new possibilities. You’ll be able to develop complicated data collections as you learn more about objects.

But first, let’s get familiar with strings and numbers!

console.log('1.Sign Up for free on CodeOfCode!');
console.log(45.89);

In the above example, we first printed a string. Our string has capital and lowercase characters, spaces, and punctuation, as well as a single word.

Next, we printed the number 45.89 without using quotation marks.

%d bloggers like this: