trait JSArrayOps[A] extends Object
Discouraged native JavaScript Array methods.
In general, you should prefer the Scala collection methods available implicitly through ArrayOps, because they are inlineable, and hence faster.
To enable the use of these functions on js.Arrays, import the implicit conversion JSArrayOps.jsArrayOps.
- Annotations
- @RawJSType() @deprecated @native()
- Deprecated
(Since version 0.6.25)
- Alphabetic
- By Inheritance
- JSArrayOps
- Object
- Any
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
jsEvery(callbackfn: Function3[A, Int, Array[A], Boolean]): Boolean
- Annotations
- @JSName( name = "every" )
-
abstract
def
jsEvery[T](callbackfn: ThisFunction3[T, A, Int, Array[A], Boolean], thisArg: T): Boolean
The every method executes the provided callback function once for each element present in the array until it finds one where callback returns a falsy value (a value that becomes false when converted to a Boolean).
The every method executes the provided callback function once for each element present in the array until it finds one where callback returns a falsy value (a value that becomes false when converted to a Boolean). If such an element is found, the every method immediately returns false. Otherwise, if callback returned a true value for all elements, every will return true. callback is invoked only for indexes of the array which have assigned values; it is not invoked for indexes which have been deleted or which have never been assigned values.
callback is invoked with three arguments:
- the value of the element - the index of the element - and the Array object being traversed.
If a thisObject parameter is provided to every, it will be used as the this for each invocation of the callback. If it is not provided, or is null, the global object associated with callback is used instead.
every does not mutate the array on which it is called.
every acts like the "for all" quantifier in mathematics. In particular, for an empty array, it returns true. (It is vacuously true that all elements of the empty set satisfy any given condition.)
MDN
- Annotations
- @JSName( name = "every" )
-
abstract
def
jsFilter(callbackfn: Function1[A, Boolean]): Array[A]
- Annotations
- @JSName( name = "filter" )
-
abstract
def
jsFilter(callbackfn: Function2[A, Int, Boolean]): Array[A]
- Annotations
- @JSName( name = "filter" )
-
abstract
def
jsFilter(callbackfn: Function3[A, Int, Array[A], Boolean]): Array[A]
- Annotations
- @JSName( name = "filter" )
-
abstract
def
jsFilter[T](callbackfn: ThisFunction3[T, A, Int, Array[A], Boolean], thisArg: T): Array[A]
filter calls a provided callback function once for each element in an array, and constructs a new array of all the values for which callback returns a true value.
filter calls a provided callback function once for each element in an array, and constructs a new array of all the values for which callback returns a true value. callback is invoked only for indexes of the array which have assigned values; it is not invoked for indexes which have been deleted or which have never been assigned values. Array elements which do not pass the callback test are simply skipped, and are not included in the new array.
callback is invoked with three arguments:
- the value of the element - the index of the element - the Array object being traversed
If a thisObject parameter is provided to filter, it will be used as the this for each invocation of the callback. If it is not provided, or is null, the global object associated with callback is used instead.
filter does not mutate the array on which it is called.
MDN
- Annotations
- @JSName( name = "filter" )
-
abstract
def
jsForEach(callbackfn: Function1[A, _]): Unit
- Annotations
- @JSName( name = "forEach" )
-
abstract
def
jsForEach(callbackfn: Function2[A, Int, _]): Unit
- Annotations
- @JSName( name = "forEach" )
-
abstract
def
jsForEach(callbackfn: Function3[A, Int, Array[A], _]): Unit
- Annotations
- @JSName( name = "forEach" )
-
abstract
def
jsForEach[T](callbackfn: ThisFunction3[T, A, Int, Array[A], _], thisArg: T): Unit
forEach executes the provided callback once for each element of the array with an assigned value.
forEach executes the provided callback once for each element of the array with an assigned value. It is not invoked for indexes which have been deleted or which have been initialized to undefined.
callback is invoked with three arguments:
- the element value - the element index - the array being traversed
If a thisArg parameter is provided to forEach, it will be used as the this value for each callback invocation as if callback.call(thisArg, element, index, array) was called. If thisArg is undefined or null, the this value within the function depends on whether the function is in strict mode or not (passed value if in strict mode, global object if in non-strict mode).
MDN
- Annotations
- @JSName( name = "forEach" )
-
abstract
def
jsIndexOf(searchElement: A): Int
- Annotations
- @JSName( name = "indexOf" )
-
abstract
def
jsIndexOf(searchElement: A, fromIndex: Int): Int
The indexOf() method returns the first index at which a given element can be found in the array, or -1 if it is not present.
The indexOf() method returns the first index at which a given element can be found in the array, or -1 if it is not present.
MDN
- Annotations
- @JSName( name = "indexOf" )
-
abstract
def
jsLastIndexOf(searchElement: A): Int
- Annotations
- @JSName( name = "lastIndexOf" )
-
abstract
def
jsLastIndexOf(searchElement: A, fromIndex: Int): Int
The lastIndexOf() method returns the last index at which a given element can be found in the array, or -1 if it is not present.
The lastIndexOf() method returns the last index at which a given element can be found in the array, or -1 if it is not present. The array is searched backwards, starting at fromIndex.
MDN
- Annotations
- @JSName( name = "lastIndexOf" )
-
abstract
def
jsMap[B](callbackfn: Function1[A, B]): Array[B]
- Annotations
- @JSName( name = "map" )
-
abstract
def
jsMap[B](callbackfn: Function2[A, Int, B]): Array[B]
- Annotations
- @JSName( name = "map" )
-
abstract
def
jsMap[B](callbackfn: Function3[A, Int, Array[A], B]): Array[B]
- Annotations
- @JSName( name = "map" )
-
abstract
def
jsMap[B, T](callbackfn: ThisFunction3[T, A, Int, Array[A], B], thisArg: T): Array[B]
map calls a provided callback function once for each element in an array, in order, and constructs a new array from the results.
map calls a provided callback function once for each element in an array, in order, and constructs a new array from the results. callback is invoked only for indexes of the array which have assigned values; it is not invoked for indexes which have been deleted or which have never been assigned values.
callback is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed.
If a thisArg parameter is provided to map, it will be used as the this for each invocation of the callback. If it is not provided, or is null, the global object associated with callback is used instead.
map does not mutate the array on which it is called.
MDN
- Annotations
- @JSName( name = "map" )
-
abstract
def
jsReduce[B](callbackfn: Function2[B, A, B]): B
- Annotations
- @JSName( name = "reduce" )
-
abstract
def
jsReduce[B](callbackfn: Function3[B, A, Int, B]): B
- Annotations
- @JSName( name = "reduce" )
-
abstract
def
jsReduce[B](callbackfn: Function4[B, A, Int, Array[A], B]): B
- Annotations
- @JSName( name = "reduce" )
-
abstract
def
jsReduce[B](callbackfn: Function2[B, A, B], initialValue: B): B
- Annotations
- @JSName( name = "reduce" )
-
abstract
def
jsReduce[B](callbackfn: Function3[B, A, Int, B], initialValue: B): B
- Annotations
- @JSName( name = "reduce" )
-
abstract
def
jsReduce[B](callbackfn: Function4[B, A, Int, Array[A], B], initialValue: B): B
reduce executes the callback function once for each element present in the array, excluding holes in the array, receiving four arguments: the initial value (or value from the previous callback call), the value of the current element, the current index, and the array over which iteration is occurring.
reduce executes the callback function once for each element present in the array, excluding holes in the array, receiving four arguments: the initial value (or value from the previous callback call), the value of the current element, the current index, and the array over which iteration is occurring.
The first time the callback is called, previousValue and currentValue can be one of two values. If initialValue is provided in the call to reduce, then previousValue will be equal to initialValue and currentValue will be equal to the first value in the array. If no initialValue was provided, then previousValue will be equal to the first value in the array and currentValue will be equal to the second.
MDN
- Annotations
- @JSName( name = "reduce" )
-
abstract
def
jsReduceRight[B](callbackfn: Function2[B, A, B]): B
- Annotations
- @JSName( name = "reduceRight" )
-
abstract
def
jsReduceRight[B](callbackfn: Function3[B, A, Int, B]): B
- Annotations
- @JSName( name = "reduceRight" )
-
abstract
def
jsReduceRight[B](callbackfn: Function4[B, A, Int, Array[A], B]): B
- Annotations
- @JSName( name = "reduceRight" )
-
abstract
def
jsReduceRight[B](callbackfn: Function2[B, A, B], initialValue: B): B
- Annotations
- @JSName( name = "reduceRight" )
-
abstract
def
jsReduceRight[B](callbackfn: Function3[B, A, Int, B], initialValue: B): B
- Annotations
- @JSName( name = "reduceRight" )
-
abstract
def
jsReduceRight[B](callbackfn: Function4[B, A, Int, Array[A], B], initialValue: B): B
reduceRight executes the callback function once for each element present in the array, excluding holes in the array, receiving four arguments: the initial value (or value from the previous callback call), the value of the current element, the current index, and the array over which iteration is occurring.
reduceRight executes the callback function once for each element present in the array, excluding holes in the array, receiving four arguments: the initial value (or value from the previous callback call), the value of the current element, the current index, and the array over which iteration is occurring.
MDN
- Annotations
- @JSName( name = "reduceRight" )
-
abstract
def
jsSome(callbackfn: Function1[A, Boolean]): Boolean
- Annotations
- @JSName( name = "some" )
-
abstract
def
jsSome(callbackfn: Function2[A, Int, Boolean]): Boolean
- Annotations
- @JSName( name = "some" )
-
abstract
def
jsSome(callbackfn: Function3[A, Int, Array[A], Boolean]): Boolean
- Annotations
- @JSName( name = "some" )
-
abstract
def
jsSome[T](callbackfn: ThisFunction3[T, A, Int, Array[A], Boolean], thisArg: T): Boolean
some executes the callback function once for each element present in the array until it finds one where callback returns a true value.
some executes the callback function once for each element present in the array until it finds one where callback returns a true value. If such an element is found, some immediately returns true. Otherwise, some returns false. callback is invoked only for indexes of the array which have assigned values; it is not invoked for indexes which have been deleted or which have never been assigned values.
callback is invoked with three arguments: the value of the element, the index of the element, and the Array object being traversed.
If a thisObject parameter is provided to some, it will be used as the this for each invocation of the callback. If it is not provided, or is null, the global object associated with callback is used instead.
some does not mutate the array on which it is called.
MDN
- Annotations
- @JSName( name = "some" )
Concrete Value Members
-
final
def
!=(arg0: scala.Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
def
+(other: String): String
- Implicit
- This member is added by an implicit conversion from JSArrayOps[A] to any2stringadd[JSArrayOps[A]] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
-
def
->[B](y: B): (JSArrayOps[A], B)
- Implicit
- This member is added by an implicit conversion from JSArrayOps[A] to ArrowAssoc[JSArrayOps[A]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
-
final
def
==(arg0: scala.Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
ensuring(cond: (JSArrayOps[A]) ⇒ Boolean, msg: ⇒ scala.Any): JSArrayOps[A]
- Implicit
- This member is added by an implicit conversion from JSArrayOps[A] to Ensuring[JSArrayOps[A]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: (JSArrayOps[A]) ⇒ Boolean): JSArrayOps[A]
- Implicit
- This member is added by an implicit conversion from JSArrayOps[A] to Ensuring[JSArrayOps[A]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean, msg: ⇒ scala.Any): JSArrayOps[A]
- Implicit
- This member is added by an implicit conversion from JSArrayOps[A] to Ensuring[JSArrayOps[A]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean): JSArrayOps[A]
- Implicit
- This member is added by an implicit conversion from JSArrayOps[A] to Ensuring[JSArrayOps[A]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: scala.Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from JSArrayOps[A] to StringFormat[JSArrayOps[A]] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @inline()
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hasOwnProperty(v: String): Boolean
Tests whether this object has the specified property as a direct property.
Tests whether this object has the specified property as a direct property.
Unlike js.Object.hasProperty, this method does not check down the object's prototype chain.
MDN
- Definition Classes
- Object
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isPrototypeOf(v: Object): Boolean
Tests whether this object is in the prototype chain of another object.
Tests whether this object is in the prototype chain of another object.
- Definition Classes
- Object
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
propertyIsEnumerable(v: String): Boolean
Tests whether the specified property in an object can be enumerated by a call to js.Object.properties, with the exception of properties inherited through the prototype chain.
Tests whether the specified property in an object can be enumerated by a call to js.Object.properties, with the exception of properties inherited through the prototype chain.
If the object does not have the specified property, this method returns false.
MDN
- Definition Classes
- Object
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toLocaleString(): String
- Definition Classes
- Object
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
valueOf(): scala.Any
- Definition Classes
- Object
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
→[B](y: B): (JSArrayOps[A], B)
- Implicit
- This member is added by an implicit conversion from JSArrayOps[A] to ArrowAssoc[JSArrayOps[A]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc