Cocos Creator API

1.3.0

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

array static

: js

remove
(
  • array
  • value
)
Boolean

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

array Any
value Any

:

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

:

verifyType
(
  • array
  • type
)
Boolean

Verify array's Type

array array
type Function

:

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