Fichas
HIGHER ORDER FUNCTIONZ
Fichas del conjunto (2)
- 1.replace()The replace() method searches a string for a specified value, or a regular expression, and returns a new string where the specified values are replaced.
*** str.replace(/blue/g, "red")
*** str.replace(/,/g, "")
*** can also take function at end!!!
var res = str.replace(/blue|house|car/gi, function myFunction(x){return x.toUpperCase();}) - 2.filter()filters an array, returns an array where of values that meet a criteria.
var ages = [32, 33, 16, 40];
function checkAdult(age) {
return age >= 18; }
var result = ages.filter(checkAdult);
}
Información
- Descripción
- MCAT Computer Studies Fichas sobre HIGHER ORDER FUNCTIONZ, creado por ig ag el 17/09/2016.
- Creado por
- ig ag · sep 2016
- Actualizado
- 19 sep 2016
- Visitas
- 0
- Valoración