Created
February 28, 2015 19:06
-
-
Save Shinpeim/cfa72344c6da95f63932 to your computer and use it in GitHub Desktop.
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
// 連想配列,またはMap,またはDictionaryと呼ばれるもの | |
// JavaSctiptではこれをObjectと呼んでいる。 | |
// Dictionaryの名の通り、「ある値」でそれを引くと | |
// それに対応する値を得ることができる。 | |
var digits = { | |
"zero": 0, | |
"one": 1, | |
"two": 2, | |
"three": 3, | |
"four": 4, | |
"five": 5, | |
"six": 6, | |
"seven": 7, | |
"eight": 8, | |
"nine": 9 | |
}; | |
// "zero"でdigitsを引くと0が手に入る | |
console.log(digits["zero"]); //0 | |
// "one"でdigitsを引くと1が手に入る | |
console.log(digits["one"]); //1 | |
// "two"でdigitsを引くと2が手に入る | |
console.log(digits["two"]); //2 | |
//...以下同じく続く | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment