Cocos Creator API

1.0.0

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

array

Module: js

Methods

remove
(
  • array
  • value
)
Boolean

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

name type description
array Any
value Any

returns:

type: Boolean

removeAt
(
  • array
  • index
)

Removes the array item at the specified index.

name type description
array Any
index Number

contains
(
  • array
  • value
)
Boolean

Determines whether the array contains a specific value.

name type description
array Any
value Any

returns:

type: Boolean

verifyType
(
  • array
  • type
)
Boolean

Verify array's Type

name type description
array array
type Function

returns:

type: 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.

name type description
array Array

Source Array

minusArr Array

minus Array

appendObjectsAt
(
  • array
  • addObjs
  • index
)
Array

Inserts some objects at index

name type description
array Array
addObjs Array
index Number

returns:

type: Array

copy
(
  • array
)
Array

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

name type description
array Array

returns:

type: 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 !

name type description
searchElement Any

Element to locate in the array.

fromIndex optional Number 0

The index to start the search at

returns:

type: 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