- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
Objects in JavaScript | Nested Objects in JavaScript | JavaScript Course for Beginners
In this video, I have discussed about ojects in javascript
#object #javascript #parnikatutorials
JavaScript object is a non-primitive data-type that allows you to store multiple collections of data.
Note: If you are familiar with other programming languages, JavaScript objects are a bit different. You do not need to create classes in order to create objects.
Here is an example of a JavaScript object.
// object
var student = {
Name: 'jagadeesh',
age: 35
};
Here, student is an object that stores values such as strings and numbers.
avaScript Object Declaration
The syntax to declare an object is:
var object_name = {
key1: value1,
key2: value2
}
Here, an object object_name is defined. Each member of an object is a key: value pair separated by commas and enclosed in curly braces {}.
For example,
// object creation
var person = {
name: 'Jagadeesh',
age: 20
};
console.log(typeof person); // object
Accessing Object Properties
You can access the value of a property by using its key.
1. Using dot Notation
Here's the syntax of the dot notation.
objectName.key
For example,
var person = {
name: 'John',
age: 20,
};
// accessing property
console.log(person.name); // John
Using bracket Notation
Here is the syntax of the bracket notation.
objectName["propertyName"]
For example,
var person = {
name: 'John',
age: 20,
};
// accessing property
console.log(person["name"]); // John
JavaScript Nested Objects
An object can also contain another object. For example,
// nested object
var student = {
name: 'John',
age: 20,
marks: {
science: 70,
math: 75
}
}
// accessing property of student object
console.log(student.marks); // {science: 70, math: 75}
// accessing property of marks object
console.log(student.marks.science); // 70
JavaScript Object Methods
In JavaScript, an object can also contain a function. For example,
var person = {
name: 'Sam',
age: 30,
// using function as a value
greet: function() { console.log('hello') }
}
person.greet(); // hello
Run Code
Here, a function is used as a value for the greet key. That's why we need to use person.greet() instead of person.greet to call the function inside the object.
Видео Objects in JavaScript | Nested Objects in JavaScript | JavaScript Course for Beginners канала Parnika Tutorials
#object #javascript #parnikatutorials
JavaScript object is a non-primitive data-type that allows you to store multiple collections of data.
Note: If you are familiar with other programming languages, JavaScript objects are a bit different. You do not need to create classes in order to create objects.
Here is an example of a JavaScript object.
// object
var student = {
Name: 'jagadeesh',
age: 35
};
Here, student is an object that stores values such as strings and numbers.
avaScript Object Declaration
The syntax to declare an object is:
var object_name = {
key1: value1,
key2: value2
}
Here, an object object_name is defined. Each member of an object is a key: value pair separated by commas and enclosed in curly braces {}.
For example,
// object creation
var person = {
name: 'Jagadeesh',
age: 20
};
console.log(typeof person); // object
Accessing Object Properties
You can access the value of a property by using its key.
1. Using dot Notation
Here's the syntax of the dot notation.
objectName.key
For example,
var person = {
name: 'John',
age: 20,
};
// accessing property
console.log(person.name); // John
Using bracket Notation
Here is the syntax of the bracket notation.
objectName["propertyName"]
For example,
var person = {
name: 'John',
age: 20,
};
// accessing property
console.log(person["name"]); // John
JavaScript Nested Objects
An object can also contain another object. For example,
// nested object
var student = {
name: 'John',
age: 20,
marks: {
science: 70,
math: 75
}
}
// accessing property of student object
console.log(student.marks); // {science: 70, math: 75}
// accessing property of marks object
console.log(student.marks.science); // 70
JavaScript Object Methods
In JavaScript, an object can also contain a function. For example,
var person = {
name: 'Sam',
age: 30,
// using function as a value
greet: function() { console.log('hello') }
}
person.greet(); // hello
Run Code
Here, a function is used as a value for the greet key. That's why we need to use person.greet() instead of person.greet to call the function inside the object.
Видео Objects in JavaScript | Nested Objects in JavaScript | JavaScript Course for Beginners канала Parnika Tutorials
javascript objects in javascript nested objects in javascript javascript tutorial javascript for beginners javascript tutorial for beginners parnika tutorials how to declare an object in javascript what is an object web desgining html css full stack development iiitdm kancheepuram learn javascript how to design website dynamic website advantages of javascript javascript full course virat kohli dhoni
Комментарии отсутствуют
Информация о видео
1 июня 2023 г. 9:11:47
00:17:34
Другие видео канала




















