-
Notifications
You must be signed in to change notification settings - Fork 19
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
'HW1' #13
base: master
Are you sure you want to change the base?
'HW1' #13
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,10 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
</head> | ||
<body>HW1 | ||
|
||
<script src="main.js"></script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
(function () { | ||
'use strict'; | ||
var cinemas, films, manager; | ||
//functions | ||
function createCinema(name, address, films, options) { | ||
options = options || {}; | ||
return { | ||
name: name, | ||
address: address, | ||
films: films | ||
}; | ||
} | ||
|
||
function createFilm(name, time, price, options) { | ||
options = options || {}; | ||
return { | ||
name: name, | ||
time: time, | ||
price: price | ||
}; | ||
} | ||
|
||
function createUser(coordinate, options) { | ||
options = options || {}; | ||
return { | ||
coordinate: coordinate | ||
}; | ||
} | ||
|
||
//base | ||
films = [1, 2, 3, 4, 5, 6, 7].map(function (name, time) { | ||
return createFilm(name, time, Math.random()); | ||
}); | ||
|
||
cinemas = ['Roliks', 'Salut', 'TitanicCinama'].map(function (name, address) { | ||
var filmsList, i, film; | ||
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. var filmsList = [], i, film; |
||
filmsList = []; | ||
for (i = 0; i < 3; i = i + 1) { | ||
film = films[Math.floor(Math.random() * (films.lenght + 1))]; | ||
filmsList.push(film); | ||
} | ||
return createCinema(name, address, films); | ||
}); | ||
|
||
//Manager | ||
manager = {}; | ||
manager.findByFilmName = function (film) { | ||
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. у вас менеджер какой-то грустный научите его еще чему нибудь |
||
var i, j; | ||
for (i = 0; i < cinemas.lenght; i = i + 1) { | ||
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. такой код можно читать как английские предложения |
||
for (j = 0; j < cinemas[i].films.lenght; j = j + 1) { | ||
if (cinemas[i].films[j].name === film) { | ||
return cinemas[i]; | ||
} | ||
} | ||
} | ||
}()); |
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.
зачем вы передаете опции, которые неиспользуете