Pot.Struct.last

{*} Pot.Struct.last ({Object|Array|*} o)

Pot.js で利用可能。 PotLite.js では利用できません。

引数 o の要素のうち最後の値を取得します。

引数 o の各要素のうち最後の値を取得し返します。

Pot.globalize() が適応されている場合、Pot.last() が last() で実行できます。

o の要素のうち最後の値が返ります。

Pot.debug(Pot.last({a: 1, b: 2, c: 3}));   // 3
Pot.debug(Pot.last({}));                   // undefined
Pot.debug(Pot.last([1, 2, 3, 4, 5]));      // 5
Pot.debug(Pot.last([]));                   // undefined
Pot.debug(Pot.last({a: 'foo', b: 'bar'})); // 'bar'
Pot.debug(Pot.last(new Array(100)));       // undefined
Pot.debug(Pot.last(null));                 // undefined
Pot.debug(Pot.last((void 0)));             // undefined
Pot.debug(Pot.last('hoge'));               // 'e'
Pot.debug(Pot.last(''));                   // ''
Pot.debug(Pot.last(new String('hoge')));   // 'e'
Pot.debug(Pot.last(123));                  // 1
Pot.debug(Pot.last(0));                    // 0
Pot.debug(Pot.last(-123));                 // 1