- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
Symbol Data Type in JavaScript | ECMAScript 2015 (ES6) | #47 @Everyday-Be-Coding
JavaScript full playlist : https://www.youtube.com/watch?v=U0I3bX04voI&list=PLdnPqkBptCEI6d2VdRlspjIU_SSyhrWHP
In JavaScript, the Symbol data type represents a unique and immutable value that can be used as an identifier for object properties. Symbols are new primitive data types introduced in ECMAScript 6 (ES6).
Here are some key points about symbols:
Uniqueness: Each symbol value is unique, even if they have the same description.
Immutability: Symbols are immutable and cannot be changed or modified.
Use as Object Keys: Symbols are primarily used as property keys for object properties. They help avoid naming collisions in object properties.
Symbol Registry: Symbols can be registered in the symbol registry to allow sharing of symbols across different parts of your application.
Description: Symbols can have an optional description, which is a string used to identify the symbol. This description is mainly used for debugging purposes and has no effect on the uniqueness of the symbol.
Here's an example demonstrating the usage of symbols:
JavaScript code
// Creating a symbol
const mySymbol = Symbol();
console.log(typeof mySymbol); // Output: "symbol"
// Symbols with descriptions
const symbolWithDescription = Symbol('My Symbol');
console.log(symbolWithDescription); // Output: Symbol(My Symbol)
// Using symbols as object keys
const obj = {};
const symbolKey = Symbol('myKey');
obj[symbolKey] = 'value';
console.log(obj[symbolKey]); // Output: value
// Symbol registry
const globalSymbol = Symbol.for('globalSymbol');
const localSymbol = Symbol('localSymbol');
console.log(Symbol.keyFor(globalSymbol)); // Output: globalSymbol
console.log(Symbol.keyFor(localSymbol)); // Output: undefined
In this example, we create symbols using the Symbol() function. We can also provide an optional description to the Symbol() function to create a symbol with a description. Symbols are then used as unique keys for object properties. Additionally, we demonstrate the use of the symbol registry with Symbol.for() and Symbol.keyFor() functions to create and retrieve symbols from the global symbol registry.
JavaScript
Programming
Web Development
Symbol Data Type
ECMAScript
ES6
JavaScript Symbols
JavaScript Primitive Types
Coding
Software Development
JavaScript Tutorial
JavaScript Concepts
JavaScript Basics
JavaScript Features
Modern JavaScript
JavaScript Language
JavaScript Development
JavaScript Learning
JavaScript Explained
JavaScript for Beginners
Chapter :
00:00 Introduction to Symbols
00:19 Key point of symbol
00:46 Example usage of symbols
02:02 Summery
Thank you for watching this video
EVERYDAY BE CODING
Видео Symbol Data Type in JavaScript | ECMAScript 2015 (ES6) | #47 @Everyday-Be-Coding канала Everyday Be Coding
In JavaScript, the Symbol data type represents a unique and immutable value that can be used as an identifier for object properties. Symbols are new primitive data types introduced in ECMAScript 6 (ES6).
Here are some key points about symbols:
Uniqueness: Each symbol value is unique, even if they have the same description.
Immutability: Symbols are immutable and cannot be changed or modified.
Use as Object Keys: Symbols are primarily used as property keys for object properties. They help avoid naming collisions in object properties.
Symbol Registry: Symbols can be registered in the symbol registry to allow sharing of symbols across different parts of your application.
Description: Symbols can have an optional description, which is a string used to identify the symbol. This description is mainly used for debugging purposes and has no effect on the uniqueness of the symbol.
Here's an example demonstrating the usage of symbols:
JavaScript code
// Creating a symbol
const mySymbol = Symbol();
console.log(typeof mySymbol); // Output: "symbol"
// Symbols with descriptions
const symbolWithDescription = Symbol('My Symbol');
console.log(symbolWithDescription); // Output: Symbol(My Symbol)
// Using symbols as object keys
const obj = {};
const symbolKey = Symbol('myKey');
obj[symbolKey] = 'value';
console.log(obj[symbolKey]); // Output: value
// Symbol registry
const globalSymbol = Symbol.for('globalSymbol');
const localSymbol = Symbol('localSymbol');
console.log(Symbol.keyFor(globalSymbol)); // Output: globalSymbol
console.log(Symbol.keyFor(localSymbol)); // Output: undefined
In this example, we create symbols using the Symbol() function. We can also provide an optional description to the Symbol() function to create a symbol with a description. Symbols are then used as unique keys for object properties. Additionally, we demonstrate the use of the symbol registry with Symbol.for() and Symbol.keyFor() functions to create and retrieve symbols from the global symbol registry.
JavaScript
Programming
Web Development
Symbol Data Type
ECMAScript
ES6
JavaScript Symbols
JavaScript Primitive Types
Coding
Software Development
JavaScript Tutorial
JavaScript Concepts
JavaScript Basics
JavaScript Features
Modern JavaScript
JavaScript Language
JavaScript Development
JavaScript Learning
JavaScript Explained
JavaScript for Beginners
Chapter :
00:00 Introduction to Symbols
00:19 Key point of symbol
00:46 Example usage of symbols
02:02 Summery
Thank you for watching this video
EVERYDAY BE CODING
Видео Symbol Data Type in JavaScript | ECMAScript 2015 (ES6) | #47 @Everyday-Be-Coding канала Everyday Be Coding
JavaScript Programming Web Development Symbol Data Type ECMAScript ES6 JavaScript Symbols JavaScript Primitive Types Coding Software Development JavaScript Tutorial JavaScript Concepts JavaScript Basics JavaScript Features Modern JavaScript JavaScript Language JavaScript Development JavaScript Learning JavaScript Explained JavaScript for Beginners
Комментарии отсутствуют
Информация о видео
21 апреля 2024 г. 23:31:53
00:02:28
Другие видео канала





![How to Change Text, Background Color and Resize Excel Comment Using EPPlus [Hindi] Part - 9(A)](https://i.ytimg.com/vi/gi6EdPNTJ2Y/default.jpg)















