Cocos Creator API

1.2.0

Cocos Creator is a highly customizable game development tool that utilizes the power of cocos2d-x.

array

模块: js

方法

remove
(
  • array
  • value
)
Boolean

Removes the first occurrence of a specific object from the array.

名称 类型 描述
array Any
value Any

返回:

类型: Boolean

removeAt
(
  • array
  • index
)

Removes the array item at the specified index.

名称 类型 描述
array Any
index Number

contains
(
  • array
  • value
)
Boolean

Determines whether the array contains a specific value.

名称 类型 描述
array Any
value Any

返回:

类型: Boolean

verifyType
(
  • array
  • type
)
Boolean

Verify array's Type

名称 类型 描述
array array
type Function

返回:

类型: Boolean

removeArray
(
  • array
  • minusArr
)

Removes from array all values in minusArr. For each Value in minusArr, the first matching instance in array will be removed.

名称 类型 描述
array Array

Source Array

minusArr Array

minus Array

appendObjectsAt
(
  • array
  • addObjs
  • index
)
Array

Inserts some objects at index

名称 类型 描述
array Array
addObjs Array
index Number

返回:

类型: Array

copy
(
  • array
)
Array

Copy an array's item to a new array (its performance is better than Array.slice)

名称 类型 描述
array Array

返回:

类型: Array

indexOf
(
  • searchElement
  • [fromIndex =0]
)
Number

Exact same function as Array.prototype.indexOf. HACK: ugliy hack for Baidu mobile browser compatibility, stupid Baidu guys modify Array.prototype.indexOf for all pages loaded, their version changes strict comparison to non-strict comparison, it also ignores the second parameter of the original API, and this will cause event handler enter infinite loop. Baidu developers, if you ever see this documentation, here is the standard: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf Seriously !

名称 类型 描述
searchElement Any

Element to locate in the array.

fromIndex optional Number 0

The index to start the search at

返回:

类型: Number

returns the first index at which a given element can be found in the array, or -1 if it is not present.

There are no methods that match your current filter settings. You can change your filter settings in the index section on this page. index