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
if(Array.isArray(a) && Array.isArray(b)){ | |
// Если оба аргумента массивы, то вернуть строку: | |
// "Общая площадь артефактов сжатия: [square] пикселей" | |
// где [square] — это сумма произведений соответствующих элементов массивов a и b, | |
// cумма произведения первого элемента a с первым элементом b, второго со вторым и так далее | |
for(var i = 0; i < a.length; i++){ | |
var arr = []; | |
arr.push(a[i] * b[i]); | |
} |
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
if(Array.isArray(a) && Array.isArray(b)){ | |
// Если оба аргумента массивы, то вернуть строку: | |
// "Общая площадь артефактов сжатия: [square] пикселей" | |
// где [square] — это сумма произведений соответствующих элементов массивов a и b, | |
// cумма произведения первого элемента a с первым элементом b, второго со вторым и так далее | |
for(var i = 0; i < a.length; i++){ | |
var arr = []; | |
arr.push(a[i] * b[i]); | |
var square = 0; | |
square += arr[i]; |
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 getMessage(a, b){ | |
if(typeof a === "boolean"){ | |
// Если первый аргумент, a, имеет тип boolean, то: | |
// Если он true, вернуть строку, в которую подставлен параметр b: | |
// "Переданное GIF-изображение анимировано и содержит [b] кадров" | |
// Если он false, то вернуть строку: | |
// "Переданное GIF-изображение не анимировано" | |
if(a === true){ | |
return "Переданное GIF-изображение анимировано и содержит " + b + " кадров"; | |
} |
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 getMessage(a, b){ | |
if(typeof a === "boolean"){ | |
// Если первый аргумент, a, имеет тип boolean, то: | |
// Если он true, вернуть строку, в которую подставлен параметр b: | |
// "Переданное GIF-изображение анимировано и содержит [b] кадров" | |
// Если он false, то вернуть строку: | |
// "Переданное GIF-изображение не анимировано" | |
if(a === true){ | |
return "Переданное GIF-изображение анимировано и содержит " + b + " кадров"; | |
} |
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 accumulate(str) { | |
// Напишите функцию accumulate, которая принимает произвольную строку, | |
// состоящую из буквенных символов. Функция обрабатывает строку по следующим правилам: | |
// на первое место ставится обрабатываемый символ в верхнем регистре | |
// после обрабатываемого символа в строке стоит обрабатываемый символ | |
// в нижнем регистре такое количество раз, какой номер символа в строке | |
// после завершения обработки символа в строку добавляется тире ('-') | |
var string = str.split(''); | |
var result = ''; | |
for (var i = 0; i < string.length; i++) { |
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 dashes(num) { | |
// Напишите функцию dashes, которая вставляет тире ('-') | |
// между каждыми двумя четными числами. Например, если было получено число 223467988 | |
// функция вернет строку '2-234-6798-8'. Ноль считайте четным числом. | |
// dashes(3551267); // '35512-67' | |
// dashes(2256472); // '2-256-472' | |
// dashes(2226988); // '2-2-2-698-8' | |
var string = num.toString(); | |
string = string.split(''); |
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 deleteLetter(str) { | |
// Напишите функцию removeLetters, которая удаляет все гласные буквы из переданной ей строки. | |
// removeLetters('This is string'); // вернет "Ths s strng" | |
// removeLetters('THIS IS STRING'); // вернет "THS S STRNG" | |
var string = str.split(''); | |
var arr = []; | |
var result = ''; | |
var letters = ['a', 'e', 'i', 'o', 'u', 'y']; | |
for ( var i = 0; i < string.length; i++) { | |
for ( var j = 0; j < letters.length; j++){ |
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
Gallery.prototype.getPictureNumber = function(url) { | |
for (var i = 0; i < this.pictures.length; i++) { | |
if (url === this.pictures[i].url) { | |
this.currentPicture = i; | |
return i; | |
} else { | |
return -1; | |
} | |
} |
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
$(document).ready(function() { | |
var tmp = $('#table-template'); | |
console.log(tmp); | |
tmp = tmp.find(".table__date").text('asdf'); | |
console.log(tmp) | |
var template = tmp.html(); | |
console.log(template) |
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 html = imgTemplate.replace("{{image}}", event.target.result); | |
html = html.replace("{{name}}", file.name); | |
var div = document.createElement("div"); | |
div.classList.add("form-photo__item"); | |
div.innerHTML = html; |
OlderNewer