Skip to content

Commit 73170cd

Browse files
authored
Update index.js
1 parent 1fc6e0e commit 73170cd

File tree

1 file changed

+30
-7
lines changed

1 file changed

+30
-7
lines changed

index.js

+30-7
Original file line numberDiff line numberDiff line change
@@ -388,14 +388,37 @@
388388
const c = Array.of(2, false, 'test', {'name': 'Alex'});
389389
}
390390

391+
// Array Like
392+
{
393+
const array_like = {
394+
0: 'A',
395+
1: 'B',
396+
2: 'C',
397+
length : 3
398+
}
399+
400+
array_like[1]
401+
402+
Array.from(array_like)
403+
404+
document.getElementsByTagName('li')
391405

392-
const array_like = {
393-
0: 'A',
394-
1: 'B',
395-
2: 'C',
396-
length : 3
406+
function checkArgs() {
407+
console.log(arguments.length);// logs 2.
408+
}
397409
}
398410

399-
array_like[1]
411+
// Array.from()
412+
{
413+
const collection = Array.from(document.getElementsByTagName('li'))
414+
}
400415

401-
Array.from(array_like)
416+
// Array.fromAsync()
417+
{
418+
Array.fromAsync({
419+
length: 3,
420+
0: Promise.resolve('tapaScript'),
421+
1: Promise.resolve('Google'),
422+
2: Promise.resolve('Apple'),
423+
}).then((array) => console.log(array));
424+
}

0 commit comments

Comments
 (0)