[Go to site: main page, start]

0% found this document useful (0 votes)
4 views10 pages

Java Script Notes

The document explains data types in JavaScript, which include Number, String, Boolean, Undefined, and Null. It also covers type conversion, distinguishing between implicit (automatic) and explicit (manual) conversion methods. Examples illustrate how to convert between different data types.

Uploaded by

monakhurana6may
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views10 pages

Java Script Notes

The document explains data types in JavaScript, which include Number, String, Boolean, Undefined, and Null. It also covers type conversion, distinguishing between implicit (automatic) and explicit (manual) conversion methods. Examples illustrate how to convert between different data types.

Uploaded by

monakhurana6may
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

data types

In JavaScript, data types define what kind of value a variable holds.

JavaScript has two main categories:

✅ Types:

1. Number
let age = 21;
let price = 99.99;

2. String

let name = "Aman";

3. Boolean

let isLoggedIn = true;

4. Undefined

let x;
[Link](x); // undefined

👉 Variable declared but no value assigned.

5. Null

let y = null;

👉 Intentional empty value.

Examples
What is Type Conversion in JavaScript?
Type conversion means changing a value from one data type to
another
Two Types of Type Conversion

1. Implicit Conversion (Automatic)


JavaScript converts types automatically
let result = "5" + 2;
[Link](result); // "52"
Number 2 becomes string → "52"

2. Explicit Conversion (Manual)


You convert types yourself
Common methods:
Number("10") // → 10
String(100) // → "100"
Boolean(1) // → true

More Examples
🔹 String to Number
Number("25") // 25
🔹 Number to String
String(50) // "50"
🔹 To Boolean
Boolean(0) // false
Boolean(1) // true
Boolean("") // false

You might also like