[Go to site: main page, start]

0% found this document useful (0 votes)
7 views1 page

JavaScript Basics: Types & Uses

JavaScript is a high-level, interpreted programming language used for adding interactivity to web pages, capable of running on both client and server sides. It features dynamic typing, prototype-based inheritance, and supports asynchronous operations. The language has two main data types: primitive types (like String, Number, Boolean) and non-primitive (reference) types (like Object, Array, Function).
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

JavaScript Basics: Types & Uses

JavaScript is a high-level, interpreted programming language used for adding interactivity to web pages, capable of running on both client and server sides. It features dynamic typing, prototype-based inheritance, and supports asynchronous operations. The language has two main data types: primitive types (like String, Number, Boolean) and non-primitive (reference) types (like Object, Array, Function).
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1. What is JavaScript?

JavaScript is a high-level, interpreted programming language primarily used to add


interactivity and dynamic behavior to web pages. It runs in the browser (client-side) and
can also run on the server (e.g., [Link]). JavaScript is: Dynamically typed – variable
types are determined at runtime. Prototype-based – uses prototypes for inheritance
rather than classical classes (though class syntax exists as syntactic sugar). Event-driven
and asynchronous-friendly – supports callbacks, promises, and async/await for handling
asynchronous operations. Common uses: Manipulating the DOM (update page
content/styles) Handling user events (clicks, form submissions) Fetching data from servers
(AJAX / Fetch API) Building full-stack apps with frameworks (React, Vue, Angular) and
[Link] on the backend

2. What are the data types in JavaScript?

JavaScript has two main kinds of data types: Primitive types and Non-primitive
(reference) types.

Primitive Data Types


These store single values and are immutable (cannot be changed).

Examples: String – "Hello" (sequence of characters) Number – 42, 3.14 (represents


integers and floating-point numbers) Boolean – true, false (logical values) Undefined – a
variable declared but not assigned a value Null – represents an intentional empty value
Symbol – Symbol("id") (unique and immutable value, often used as object keys) BigInt –
123n (used for very large integers beyond Number limits) Non-Primitive (Reference)
Data Types
These store collections or objects.

Examples: Object – {name: "Darshan", age: 21} Array – [1, 2, 3] Function – function
greet(){} Example Code:
let name = "Darshan"; // String let age = 21; // Number let isStudent = true; // Boolean let x;
// Undefined let y = null; // Null let big = 123n; // BigInt let person = {name: "DC"}; // Object

You might also like