Javascript Inbuit Objects
Javascript Inbuit Objects
Frequency 4
JavaScript provides a variety of built-in objects that are used to perform a range
of tasks and operations. These objects are foundational to the language and are
categorized into several groups based on their functionality. Here's an overview of
some of the key built-in objects in JavaScript:
Primitive Objects:
1. Number: Represents numerical values, both integers and floating-point
numbers.
Example:
Example:
Example:
4. BigInt: Represents large integers that are outside the safe integer range of the
Number type.
Example:
Example:
Composite Objects:
1. Array: Represents ordered collections of values.
Example:
Example:
const person = {
name: "Alice",
age: 30,
isStudent: false
};
Example:
function greet(name) {
return `Hello, ${name}!`;
}
Example:
Utility Objects:
1. Math: Provides mathematical constants and functions.
Example:
Example:
Error Objects:
1. Error: Represents a generic error.
Example:
Example:
Example:
try {
eval('let');
} catch (e) {
console.log(e instanceof SyntaxError); // true
}
Example:
try {
const range = Math.pow(10, 1000);
} catch (e) {
console.log(e instanceof RangeError); // true
}
These built-in objects form the basis of JavaScript programming and are widely
used in various operations such as arithmetic, string manipulation, date and time
handling, and error handling.