-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Домашнее задание 2 #1
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* Возращает объект Event | ||
* | ||
* @param {Number|Date} DateStart Начало события | ||
* @param {Number|Date} DateFinish Конец события | ||
* @param {String} [name="Новое событие"] Имя события | ||
* @param {String} [description="Описание события"] Описание события | ||
* @param {Object} Parent Предшествующие связанные события | ||
* @param {Object} Childs Последующие связанные события | ||
* @param {Object} Comments Отзывы о прошедшем мероприятии | ||
* @param {Object} Peoples Участники события | ||
* @param {Object} Location Место проведения | ||
* @param {Boolean} Private Флаг приватности | ||
* @param {Number} Rank Оценка | ||
* @param {Number} EvRS Возрастное ограничение | ||
* @param {Sting} [link=""] Ссылка на внешний ресурс | ||
* | ||
* | ||
* | ||
*/ | ||
|
||
function Event(Call, DateStart, DateFinish, Description, Parent, Childs, Comments, Peoples, Location, Private, Rank, EvRS, Link) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Именая переменных принято называть с маленькой буквы. Тебе не кажется, что параметров слишком много? Подумай как можно сделать твой код более читемым. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. В Python можно писать что-то в духе "def func( **kwargs):", где kwargs словарь с парами "переменная: значение". Тут видимо как-то аналогично, нет? function Event( eventvars ) {} ? // evemtvars = { Call = "Событие", Description="Новое событие", Private=false} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Да, так подойдет. #2 (comment) |
||
'use strict'; | ||
return { | ||
"start": DateStart || new Date(), | ||
"end": DateFinish, | ||
"name": Call || "Новое событие", | ||
"description": Description || "Описание события", | ||
"parent": Parent || {}, | ||
"childs": Childs || [], | ||
"comments": Comments || [], | ||
"peoples": Peoples || [], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Немного gramar nazi - people множественное число и без s (peoples - народы) |
||
"location": Location || {}, | ||
"private": Private || False, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
"rank": Rank || 0, | ||
"EvRS": EvRS || 18, | ||
"Link": Link || '' | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Описание полей хорошо бы выстроить в одну колонку. Ты же не Маяковский ;-)
Так ведь на много лучше