为什么JavaScript没有最后一种方法? [英] Why doesn't JavaScript have a last method?

查看:92
本文介绍了为什么JavaScript没有最后一种方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

JavaScript Array类没有提供检索数组最后一个元素的最后一个方法,这有点奇怪。我知道解决方案很简单(Ar [Ar.length-1]),但是,这种情况经常被使用。

Its kinda weird that the JavaScript Array class does not offer a last method to retrieve the last element of an array. I know the solution is simple (Ar[Ar.length-1] ), but, still, this is too frequently used.

任何严重的原因导致这种情况未被纳入然而?

Any serious reasons why this is not incorporated yet?

推荐答案

因为Javascript变化非常慢。这是因为人们慢慢升级浏览器。

Because Javascript changes very slowly. And that's because people upgrade browsers slowly.

许多Javascript库实现了自己的 last()函数。使用一个!

Many Javascript libraries implement their own last() function. Use one!

这篇关于为什么JavaScript没有最后一种方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆