7 вопрос по javascript // 7 Questions about javascript /ответьте мне пожалуйста | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 2

7 вопрос по javascript // 7 Questions about javascript /ответьте мне пожалуйста

1.Переменные JavaScript являются контейнерами для значений. Объекты также являются переменными, но они могут хранить много значений. ((зачем нужны объекты, если есть массивы? и зачем вообще придумовать столько много значения, которые означают хранилище?)) 2. объекты javascript являются контейнерами для указаний значений ((а переменный что не могут типо быть контейнерамип для указаний значений?)) 3.Метод объекта является свойством, содержащим определение функции. (( То есть методы объекта это тоже такие своеобразные контейнеры, хранилища?)) 4.Ключевое слово this ссылается на текущий объект. ((ну и зачем? есть же объекты которые созданы для указаний значений значит через указания значений можно ссылаться на текущий объект и зачем ссылатся на объекты?)) 5.Стандартным способом создания "типа объекта" ((какой еще типа объекта это что вообще такое тип объекта?)) является использование функции конструктора объекта. function person(name, age, color) { this.name = name; this.age = age; this.favColor = color; }

2nd Aug 2018, 11:03 AM
MakarovDs
3 ответов
0
Вышеуказанная функция (person) является конструктором объекта,((где они тут объект увидели? если это функция является конструктором объекта то где её оператор new?)) принимающим параметры и присваивающим их к свойствам объекта. ((какие еще свойства объекта где они тут написали свойства объекта здесть только объекты, переменные, и ссылки написаны) )6. var p1 = new person("John", 42, "green"); var p2 = new person("Amy", 21, "red"); document.write(p1.age); // Outputs 42 document.write(p2.name); // Outputs "Amy" Как только у вас появился конструктор объекта, (( есои это конструктор то где её функция?)) вы можете использовать ключевое слово new для создания новых объектов одинакового типа. (( зачем если есть массивы?)) 7.Методы являются функциями, которые хранятся как свойства объекта. ((в смысле хранятся как свойства объекта. объект это просто контейнер для именований значений типо свойства хранится как именование значений?))
2nd Aug 2018, 11:04 AM
MakarovDs
0
1. Variables JavaScript are containers for values. Objects are also variables, but they can store many values.(( Why do we need objects if there are arrays? and why do we need to invent so many values ​​that mean the repository?) ?)) 2. javascript objects are containers for indicating values ​​((and variable that can not be containers for specifying values?)) 3 The method of the object is a property that contains the definition of a function. ((That is, the methods of the object are also such peculiar containers, repositories?)) 4. The keyword this refers to the current object. ((Well, why? There are also objects that are created for indicating values. So, through the indication of values, you can refer to the current object and why does it refer to objects?)) 5. The standard way to create an "object type" ((what type of object is this type of object?)) is the use of the constructor function of the object. function person (name, age, color) {this.name = name; this.age = age; this.favColor = color; } The above
2nd Aug 2018, 11:05 AM
MakarovDs
0
function (person) is the object's constructor, ((where did they see the object? If this function is the object's constructor, where is its operator new?)) Accepting the parameters and assigning them to the properties of the object. ((what other properties of the object where they wrote the object properties here only objects, variables, and references are written)) 6. var p1 = new person ("John", 42, "green"); var p2 = new person ("Amy", 21, "red"); document.write (p1.age); // Outputs 42 document.write (p2.name); // Outputs "Amy" Once you have an object constructor, ((if its a constructor, where is its function?)), You can use the new keyword to create new objects of the same type. ((why if there are arrays?)) 7. Methods are functions that are stored as object properties. (in the sense of being stored as properties of an object, is the object just a container for naming values, which type of property is stored as value naming?))
2nd Aug 2018, 11:06 AM
MakarovDs