JS Objects - A perfect storage of browser
Object - The Introduction
The object is a type representing one of the JS data types. It is used to store various keyed collections and more complex entities. These Objects can be created using the Object()
constructor or the object initializer.
Nearly all Objects in Js are instances of object
a typical object inherits properties from object.prototype
, although these properties may be overridden. Null prototypes are the only objects which don't inherit from object.prototype
. These changes are seen by all objects through prototype chaining unless the properties and methods subject to those changes are overridden further along the prototype chain. This provides a very powerful although potentially dangerous mechanism to override or extend object behavior. To make it more secure, Object.prototype
is the only object in the core JavaScript language that has immutable prototype — the prototype of Object.prototype
is always null
and not changeable.
Object() constructor
The object() constructor turns the input into an object. Its behavior depends on the input type. If the value is null or undefined, it creates and returns an empty object. Otherwise, it returns an object of a type That corresponds to the given value. If the value is an object already, it returns the value.
-->*Syntax*
new Object(value)
Object(value)
-->*Example*
const P = new Object();
P.code = 'Don by EOD';
console.log(P);
//Output:- { code: 'Don by EOD' }
Other ways to create an object
-->*Example*
const ME = {
Name: 'Prajwal V Naik',
Skill: 'MERN',
Thrustahead: 'iNeuoron'
};
console.log(ME.Skill);
//Output:- MERN
To continue................with my studies..................
Subscribe to my newsletter
Read articles from Prajwal V Naik directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Prajwal V Naik
Prajwal V Naik
I'll develop a wonderful responsive webpage...!