Created
August 31, 2015 13:04
-
-
Save semicolon/3520ea9ae8fe6b46ffc8 to your computer and use it in GitHub Desktop.
IE8 で Object の要素数を取得する
This file contains 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 obj = { | |
"key0": "val0", | |
"key1": "val1", | |
"key2": "val2", | |
} | |
/* | |
以下は IE8 で動かない | |
var len = Object.keys(obj).length; | |
*/ | |
//一度ループさせて数を取得する必要がある | |
var len = 0; | |
for (key in obj) { | |
len++; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment