¡GoConqr estrena diseño! Cuéntanos qué te parece.

Fichas

Javascript methods

Ben Parish Javascript Inglés 4 fichas

Fichas del conjunto (4)

  1. 1What is the difference between the slice( ), splice( ), & split( ) methodsThe slice( ) method copies a given part of an array and returns that copied part as a new array. It doesn’t change the original array.
    array.slice(from, until);
    The splice( ) method changes an array, by adding or removing elements from it. Let’s see how to add and remove elements with splice( ):
    array.splice(index, number of elements);
    array.splice(2);
    The split( ) method is used for strings. It divides a string into substrings and returns them as an array. It takes 2 parameters, and both are optional.
    string.split(separator, limit);
  2. 2What is the difference between call and apply?The difference is that apply lets you invoke the function with arguments as an array; call requires the parameters be listed explicitly. A useful mnemonic is "A for array and C for comma."
    Pseudo syntax:
    theFunction.apply(valueForThis, arrayOfArgs)
    theFunction.call(valueForThis, arg1, arg2, ...)
  3. 3What is the difference between forEach(..), every(..), and some(..)forEach(..) will iterate over all values in the array, and it ignores any callback return values. every(..) keeps going until the end or the callback returns a false (or “falsy”) value, whereas some(..) keeps going until the end or the callback returns a true (or “truthy”) value.
  4. 4What is the difference between Object.keys(..) and Object.getOwnPropertyNames(..)Object.keys(..) returns an array of all enumerable properties, whereas Object.getOwnPropertyNames(..) returns an array of all properties,enumerable or not.

Información

Descripción
Javascript Fichas sobre Javascript methods, creado por Ben Parish el 29/05/2019.
Creado por
Ben Parish
Visitas
1
Valoración

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?