This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Почитать про систему прототипирования в JS: | |
https://learn.javascript.ru/function-prototype | |
https://learn.javascript.ru/native-prototypes | |
2. Выполнить первое или второе задание на выбор по ссылке: https://materials.itstep.org/content/4cff49e1-88fb-44a6-9b5d-f4ee836ef81c/ru | |
Использовать ключевое слово class, сделать три свойства и метод. В методе применить document.write() для генерации контента на странице. | |
Создать один или несколько объектов на основе класса, запустить метод, проверить что всё работает. | |
Ссылку на гист/репозиторий с решением прислать в комментарий к этому ДЗ. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//------------------ 111 | |
// let input = prompt("Input number: "); | |
// let number = Number(input); | |
// | |
// if (isNaN(number)) | |
// { | |
// alert("Please enter a number"); | |
// } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let rectangle = { | |
topLeft: {x:0, y:0}, | |
bottomRight: {x:0, y:0} | |
} | |
function width(rect){ | |
return rect.bottomRight.x - rect.topLeft.x; | |
} | |
function height(rect){ | |
return rect.topLeft.y - rect.bottom.y; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// utils.jsx: | |
export function add(a, b) { return a + b; } | |
export function subtract(a, b) { return a - b; } | |
export const PI = 3.14; | |
// another file | |
import { add } from './utils'; // импортируем только add | |
import { add, subtract, PI } from './utils'; // импортируем всё | |
// именованные экспорты — лучший выбор по умолчанию. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <windows.h> | |
#include <string> | |
using namespace std; | |
// структура товарів | |
struct Product { | |
int id; | |
char name[50]; | |
float price; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Title</title> | |
</head> | |
<body> | |
<h1>Демонстрация работы с массивами</h1> | |
<p id="output"></p> | |
<p id="output2"></p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Задание 1 | |
Создать массив из 10 случайных чисел и написать несколько функций для работы с ним. | |
Функция принимает массив и выводит его на экран. | |
Функция принимает массив и выводит только четные элементы. | |
Функция принимает массив и возвращает сумму всех элементов массива. | |
Функция принимает массив и возвращает его максимальный элемент. | |
Функция добавления нового элемента в массив по указанному индексу. | |
Функция удаления элемента из массива по указанному индексу. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Task 1 | |
// Создать объект, описывающий прямоугольник (хранит координаты левой верхней и правой нижней точек), | |
// и написать следующие функции, для работы с таким объектом. | |
// 1. Функция принимает объект-прямоугольник и выводит информацию о нем (где какая точка расположена). | |
// 2. Функция принимает объект-прямоугольник и возвращает его ширину. | |
// 3. Функция принимает объект-прямоугольник и возвращает его высоту. | |
// 4. Функция принимает объект-прямоугольник и возвращает его площадь. | |
// 5. Функция изменения ширины прямоугольника. Она принимает объект-прямоугольник и на сколько единиц изменить ширину. | |
let rectangle = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Title</title> | |
</head> | |
<body> | |
<script> | |
// Task 1 | |
// Написать функцию, которая принимает 2 числа и возвращает меньшее из них. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<link rel="stylesheet" href="public/style.css"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>WS playground</title> | |
<link rel="stylesheet" href="/style.css"> | |
</head> | |
<body> |
NewerOlder