Pot.js で利用可能。 PotLite.js では利用できません。
引数 o の要素のうち最後のキー名を取得します。
引数 o の各要素のうち最後のキー名を取得し返します。
Pot.globalize() が適応されている場合、Pot.lastKey() が lastKey() で実行できます。
o の要素のうち最後のキー名が返ります。
Pot.debug(Pot.lastKey({a: 1, b: 2, c: 3})); // 'c' Pot.debug(Pot.lastKey({})); // undefined Pot.debug(Pot.lastKey([1, 2, 3, 4, 5])); // 4 Pot.debug(Pot.lastKey([])); // undefined Pot.debug(Pot.lastKey({a: 'foo', b: 'bar'})); // 'b' Pot.debug(Pot.lastKey(new Array(100))); // undefined Pot.debug(Pot.lastKey(null)); // undefined Pot.debug(Pot.lastKey((void 0))); // undefined Pot.debug(Pot.lastKey('hoge')); // 3 Pot.debug(Pot.lastKey('')); // null Pot.debug(Pot.lastKey(new String('hoge'))); // 3 Pot.debug(Pot.lastKey(123)); // 2 Pot.debug(Pot.lastKey(0)); // 0 Pot.debug(Pot.lastKey(-123)); // 2