JavaScript Datatypes: Object and Array Datatypes

Publié le: 16 avril 2020
sur la chaîne: Binary Cave
122
9

JavaScript being an object-based language and in JavaScript almost everything is an object or acts like an object. So lets understand objects in JavaScript from datatypes perspective.
A JavaScript object is just a collection of key value pairs where keys are the properties of objectives and values are their values.
We create objects with the help of curly brackets {} with an optional list of properties. A property is a "key: value" pair, where the key (or property name) is always a string, and value (or property value) can be any data type, like numbers, booleans, strings or complex data type like arrays, functions, and other objects.
var student= {
name: "Majid",
parentage: "Ghulam Rasool",
age: 21,
gender: "Male",
};
Another important datatype in JavaScript is Array. An array is a kind of datatype used for storing multiple values under a single variable. Each element in an array has a numeric position, known as its index, and it may contain data of any data type-numbers, strings, booleans, functions, objects, and even other arrays. Arrays are zero indexed meaning index starts from 0, so that the first array element is arr[0] not arr[1].
var courses= ["BCA", "BSC", "BA", "Commerce"];


Sur cette page du site, vous pouvez voir la vidéo en ligne JavaScript Datatypes: Object and Array Datatypes durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Binary Cave 16 avril 2020, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 122 fois et il a aimé 9 téléspectateurs. Bon visionnage!