Objects in JavaScript| JavaScript Objects Explained| Why We Use Objects in JavaScript?
? Complete Playlist of Frontend Development with Meta https://www.youtube.com/playlist?list=PLfQLfkzgFi7btV5yeUAP1JbsyaMq6Os6j
In programming, if you have groups of data that you would like to relate, you can assign them to something known as an object. In this video, I'll help you to understand why we use objects in JavaScript. I'll also demonstrate how to build objects using dot notation, as well as by specifying comma delimited key-value pairs. Let's say that you are using JavaScript to build a game where the objective is to build your own cookie selling business. Your game is turn-based and uses tiles for characters to move, trade, and build their company. Your first task is to build a store manager character. You need to set certain traits, so let's call them with JavaScript variables. We'll set some numbers for the movement range, social skills, street smarts, and help. There. You've created a store manager, but there are a few improvements that you could make in your code. One issue is the long length of the variable names. Another is that your code does not explain to JavaScript that these variables are related and all describe the same character. This is where objects come in. Using objects, we can resolve these pain points by shortening our variable names and getting JavaScript to understand that all those variables are related. Let's start by declaring the variable store manager to which you assign an opening and a closing curly brace This creates an empty object literal. Next, instead of declaring individual variables for the traits, you can add a dot operator to each one, right after the words store manager. Now, when you inspect the store manager object, it recognizes these as traits of the store manager. Here you have built a store manager object using dot notation. Each trait is a property of the object. Objects can be described as collections of related properties where each property is represented as a key value pair. This means that what is normally a variable name becomes a property key and what is normally a variable's value becomes the property value of the object. Objects can also be built by listing the key value pairs inside of the object literal, which specifies them as comma delimited properties. To demonstrate, let's build a new character object.
Subscribe to our channel for more computer science related tutorials| https://www.youtube.com/@learnwithgeeks
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Objects in JavaScript| JavaScript Objects Explained| Why We Use Objects in JavaScript?», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.