... in which you battle against the creativity of your fellow Artisan Wizards.
Методы перешли на следующий уровень.
Методы теперь могут принимать аргументы, которые говорят методу как ему выполнять свое действие. Здесь "Hello!" это то что говорит метод say(). (Кавычки нужны потому что это строка текста, а текстовые строки обязательно нужно заключать в кавычки. Просто так надо.)
Если аргументов несколько, то их нужно разделять запятыми. В методе move(5, 6);, 5 - это первый аргумент (координата x), а 6 - второй аргумент (координата y). (Числа используются без кавычек.)
| var coin, firstMineIndex, lastMineIndex, pr; | |
| this.detonate = function(i) { | |
| return this.say("Detonate " + i, [i]); | |
| }; | |
| firstMineIndex = 2; | |
| lastMineIndex = 120; |
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
| <title>А. ШЕНЬ. ПРОГРАММИРОВАНИЕ. Теоремы и задачи</title> | |
| </head> | |
| <body> | |
| <div> | |
| <h2>А. ШЕНЬ</h2> | |
| <h1>ПРОГРАММИРОВАНИЕ</h1> | |
| <h1>теоремы и задачи</h1> |
http://eloquentjavascript.net/2nd_edition/preview/03_functions.html
Consider this puzzle: by starting from the number 1 and repeatedly either adding 5 or multiplying by 3, an infinite amount of new numbers can be produced. How would you write a function that, given a number, tries to find a sequence of such additions and multiplications that produce that number? For example, the number 13 could be reached by first multiplying by 3 and then adding 5 twice, whereas the number 15 cannot be reached at all.
Here is a recursive CoffeeScript solution:
findSolution = (target) ->
find = (start, history) ->
if start is target
history
else if start > target
http://eloquentjavascript.net/2nd_edition/preview/03_functions.html
Consider this puzzle: by starting from the number 1 and repeatedly either adding 5 or multiplying by 3, an infinite amount of new numbers can be produced. How would you write a function that, given a number, tries to find a sequence of such additions and multiplications that produce that number? For example, the number 13 could be reached by first multiplying by 3 and then adding 5 twice, whereas the number 15 cannot be reached at all.
Here is a recursive CoffeeScript solution:
findSolution = (target) ->
find = (start, history) ->
if start is target
history
else if start > target| { | |
| "plan": [ | |
| { | |
| "month": "ЯНВАРЬ", | |
| "days": [ | |
| { | |
| "day": "1", | |
| "reading": "Быт. 1, 2, 3" | |
| }, | |
| { |