-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscript2.js
More file actions
28 lines (23 loc) · 826 Bytes
/
script2.js
File metadata and controls
28 lines (23 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//завдання про алфавіт
const numbers = [8, 5, 12, 12, 15]
function alphabet(array){
let charAt = array.map((value, index) => {
return (value + 9).toString(36)
})
return charAt
}
console.log(alphabet(numbers).join(''))
//об'єкт
//не виходить вивести саме values об'єкта, а тільки keys(
let obj = {a:2, b:3, c:'hello', d:-1, e:{num: 23, query: 2}, f:4};
let numbers = Object.fromEntries(
Object.entries(obj).map(([key, value]) => [key, typeof value !== 'string' && typeof value !== 'object' && value >= 0]));
var keys = Object.keys(numbers);
var filtered = keys.filter(function(key) {
if(typeof key !== true)
return numbers [key]
typeof filtered == 'object';
});
let filt = Object.assign({}, filtered);
console.log(filt)
//camelCase