-
Предположим, вы закоммитили много файлов и поняли, что сообщение коммита получилось не особенно понятным. После этого вы решили данное сообщение изменить. Для того чтобы это сделать, воспользуйтесь следующей командой:
git commit --amend -m "Новое сообщение"
- Предположим, вы хотели закоммитить шесть файлов, но, по ошибке, закоммитили лишь пять. Кажется, что исправить эту ошибку можно, просто создав новый коммит и добавив туда недостающий шестой файл.
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
| var numberArray=[60, 50, 62, 58, 54, 54]; | |
| numberArray.sort(compareNumbers); | |
| console.log(numberArray); | |
| function compareNumbers(num1, num2) { | |
| return num1-num2; | |
| } |
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
| var products = [ { name: "Grapefruit", calories: 170, color: "red", sold: 8200 }, | |
| { name: "Orange", calories: 160, color: "orange", sold: 12101 }, | |
| { name: "Cola", calories: 210, color: "caramel", sold: 25412 }, | |
| { name: "Diet Cola", calories: 0, color: "caramel", sold: 43922 }, | |
| { name: "Lemon", calories: 200, color: "clear", sold: 14983 }, | |
| { name: "Raspberry", calories: 180, color: "pink", sold: 9427 }, | |
| { name: "Root Beer", calories: 200, color: "caramel", sold: 9909 }, | |
| { name: "Water", calories: 0, color: "clear", sold: 62123 } | |
| ]; |
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
| function makeCounter() { | |
| var count = 0; | |
| function counter() { | |
| count+=1; | |
| return count; | |
| } | |
| return counter; | |
| } |
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
| /*функция makePassword получает пароль в аргументе и возврщает функцию, которая принимает введеную строку и возвращает true, если введеная | |
| строка совпадает с паролем*/ | |
| function makePassword(password) { | |
| return function input(passwordGuess) { | |
| return (passwordGuess===password); | |
| }; | |
| } | |
| var password = makePassword(123); |
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
| function makeTimer(doneMessage, n) { | |
| setTimeout(function () { | |
| alert(doneMessage); | |
| }, n); | |
| } | |
| makeTimer("Cookies are done!", 1000); |
-
Представим типичную ситуацию — вы пишете что-то, вам надо воспользоваться какой-то функцией, например, str_replace(). Чтобы получить небольшое описание функции(её синтаксис и список параметров), необходимо зажать ctrl и навести мышкой на стандартную функцию.
Чтобы открыть полную документацию по функции, то необходимо нажать ctrl+Q (или F1 на Mac)
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
| var cadiParams = { | |
| make: "GM", | |
| model: "Cadillac", | |
| year: 1955, | |
| color: "tan", | |
| passengers: 5, | |
| convertible: false, | |
| mileage: 12892 | |
| }; | |
| var cadi = new Car(cadiParams); |
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
| //constructor | |
| function Dog(name, breed, weight) { | |
| this.name = name; | |
| this.breed = breed; | |
| this.weight = weight; | |
| } | |
| //create prototype | |
| Dog.prototype.species = "Canine"; | |
| Dog.prototype.bark = function () { |
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
| function Dog(name, breed, weight) { | |
| this.name = name; | |
| this.breed = breed; | |
| this.weight = weight; | |
| } | |
| Dog.prototype.species = "Canine"; | |
| Dog.prototype.bark = function () { | |
| if (this.weight > 25) { | |
| console.log(this.name + " says Woof!"); |
