Created
October 10, 2014 12:53
-
-
Save cheng470/05eb96a112f943097293 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
clearArray1 = (arr) -> | |
arr.splice 0, arr.length # 返回被删除的部分,即原数组 | |
clearArray2 = (arr) -> | |
arr.splice 0, arr.length | |
arr # 返回被清空的数组 | |
clearArray3 = (arr) -> | |
arr.splice 0, arr.length | |
return # 单独使用return,什么都不返回 | |
arr = ["a", "b", "c"] | |
console.log clearArray1(arr) | |
console.log clearArray2(arr) | |
console.log clearArray3(arr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment