Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
.push()将值附加到数组时,是否有 JavaScript(甚至在咖啡脚本中)的简写?很像 php 的$array[] = 'added to array';.
.push()
$array[] = 'added to array';
你只需要使用.push().
使用coffeescript 只会为您提供删除括号的便利。
您可以使用arr[arr.length] = "new value",但没有其他快捷方式。
arr[arr.length] = "new value"