質問するログイン新規登録

回答編集履歴

1

length プロパティの説明追加

2016/09/20 02:48

投稿

think49
think49

スコア18196

answer CHANGED
@@ -1,7 +1,23 @@
1
+ ### Array.isArray
2
+
1
3
  「配列ではないから」ではないでしょうか。
2
4
 
3
5
  ```JavaScript
4
6
  console.log(Array.isArray(words));
5
7
  ```
6
8
 
9
+ ### length プロパティ
10
+
11
+ length を扱える Object 型は配列の他にもいくつかありますが、length が規定されたものでしか扱えず、Object 型全般で扱えるプロパティではありません。
12
+
13
+ - 配列
14
+ - NodeListのインスタンス
15
+ - HTMLCollectionのインスタンス
16
+
17
+ words が直属で持つプロパティの数を数える事が目的なら下記コードで参照可能です。
18
+
19
+ ```JavaScript
20
+ Object.keys(words).length
21
+ ```
22
+
7
- Re: yajin さん
23
+ Re: Re: yajin さん