Skip to content

Instantly share code, notes, and snippets.

@kaflan
Created October 25, 2015 18:45
Show Gist options
  • Save kaflan/8798c961d85ce0c292f7 to your computer and use it in GitHub Desktop.
Save kaflan/8798c961d85ce0c292f7 to your computer and use it in GitHub Desktop.
Задания номер 2
//Задание 1. Таблицы умножения
function generateTable(w,h) {
var table = '';
for (var i = 1; i <= w; i++) {
for (var j = 1; j <= h; j++) {
var result = i * j;
table += (result < 10 ? ' ' : ' ') + result;
}
table += '\n';
}
return table;
}
//Задание 2. Иголка в стогу сена
function search(num, obj) {
if((typeof num) === Number) {
var k = obj.hasOwnProperty(num);
if((typeof k) === Object){
return search(num, k);
}
return true;
}
return false;
}
//Задание 3. Калькулон
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment